Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Did you bother to check the things the error is suggesting that you check?
  2. No it doesn't. Where did you get that information from? A connection remains open until you specifically close it or until it is automatically closed when the script execution ends on the current page request.
  3. It's highly likely that the code you posted/removed in the first post was NOT the actual code that exhibited the problem. Your actual code was likely fetching, but not using, the first row of data, in between your query statement and the start of the while() loop.
  4. If you store the failed count in a session variable, a hacker can simply drop the current session id when his script visits your site, start another session, and keep trying values forever.
  5. A) The error is probably because you used a short open tag <? B) You should stick to the traditional if(){} construct and you should format your code so that it is readable C) Why are you switching into/out of php so many times in one statement? No one can read that mess, including you. if($forum_user['g_id'] <= USER_MOD){ echo "<th class='tcr'>{$lang_online['IP']}</th>\n"; }
  6. Think about this, how would a human perform this task? You would 'remember' the current category and only process a category heading when the category name changes. How do computers 'remember' values? They store them in variables. How do computers test if a value changes? They use an if(){} conditional test. $current_category = ''; // initialize to a value that will never exist as data while($row = mysql_fetch_assoc($result)){ // test if the category changed if($current_category != $row['cat_title']){ // category changed (or it is the first one detected), output the heading here .... // remember the current category for the next test $current_category = $row['cat_title']; } // output the product data here .... }
  7. It would seriously help if you posted the name you used for the text box array name, as the code that objNoob posted has nothing to do with what you are actually doing. To iterate over the text boxes, you would use code similar to the following - foreach($_POST['the_form_field_array_name_here'] as $value){ // $value will contain each of the submitted field values in turn // test if $value is not empty and use as needed inside this loop }
  8. You don't need to loop... or use any other complicated methods. The following is for a type='file'. Just change it to a type='text' - <script type="text/javascript"> function add_field(){ var max = 4; // total number of fields var cont = document.getElementById('addhere'); // refer to the div var numfields = cont.getElementsByTagName("input").length; // get number of input fields in the div if(numfields < max){ // create a div element var div1 = document.createElement('div'); // Get template data div1.innerHTML = document.getElementById('fieldtpl').innerHTML; // append to div, so that template data becomes part of document document.getElementById('addhere').appendChild(div1); } } </script> <form method="post" action="formaction.php" enctype="multipart/form-data" > <div id="addhere"> <input type="file" name="upload[]" value="" size="50" onchange="add_field();" > </div> <input type="submit"> </form> <!-- Template. This whole data will be added directly to working div above --> <div id="fieldtpl" style="display:none"> <input type="file" name="upload[]" value="" size="50" onchange="add_field();" > </div>
  9. If you don't mind if the page refreshes when you add an input box, you can simply put a link that when submitted will cause you php script to 'dynamically' add the HTML for one more input field to the page. You would probably want to maintain the number of input fields either as a hidden field or as part of the link. If you don't want the page to refresh when you add an input box, you can do this using javascript to append an input field to a <div>. There are a ton of javascript 'append an input field' scripts posted all over the Internet. In either case, use a HTML array field name so that you can simply use php's array functions to iterate over the data once it is submitted - http://us.php.net/manual/en/faq.html.php#faq.html.arrays
  10. It's probably because you are using short open tags <? and you php code is not being seen as php code. Use full opening tags <?php
  11. To get the count returned, you need to put it into the SELECT list, Since you are also using it in the order by, use an alias so that you don't need to repeat it and since you are counting everything in each group, use COUNT(*) - SELECT team, COUNT(*) as cnt FROM `userfields` GROUP BY team ORDER BY cnt DESC You can access the cnt value in your php code using $row['cnt']
  12. See the COUNT() function at this link - http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html
  13. Your problem is likely the BOM characters. Save your file without the BOM characters or save it as an ANSI/ascii encoded file. @BlueSkyIS, the forum's [ php ] tag menu item messes up the code that is posted by adding all kinds of tabs/newlines, so you cannot go by what gets posted through that method. Yes, well you didn't bother to state what you tried.
  14. You don't apply mysqli_real_escape_string() the whole query string. You apply it to each piece of data that is put into the query.
  15. See reply #2 in this sticky post - http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
  16. I don't see any code in there that is setting the cookie in question, but the best guess is your cookie is 'missing' because you are redirecting to a host-name/sub-domain (www. vs no www) that is different than where the cookie was set and the cookie parameters are not set to match all variations of your domain.
  17. show is a reserved keyword. You either need to rename you table to something else or enclose show in back-ticks `` every time you use it in a query.
  18. That would indicate that your php code is incorrect or that the resulting HTML is incorrect.
  19. http://en.wikipedia.org/wiki/Memory_leak
  20. You (generally) need a AddType application/x-httpd-php .php statement in your httpd.conf file. Stop and start your web server to get any changes made to the httpd.conf to take effect. Also, any chance you are using short open tags in your code?
  21. Did you look directly in your database to see what exactly is being saved? If you do, you will find that the data is saved correctly. Your problem is most likely invalid HTML where you output/echo the contents. This problem is usually due to missing quotes around the data value when you output it into form fields.
  22. To get today's date, you can just use the mysql CURDATE() function directly in your query. To get help with the dropdown code you tried, you would need to post it along with telling what it did or did not do.
  23. http://w3schools.com/php/php_mysql_update.asp (this link is part of a whole basic php/mysql tutorial that you should probably read through.) Putting () around a string has no meaning and may even produce an error.
  24. What doesn't work? You haven't shown or stated any actual problems or errors or results (or lack of) in this thread. Based on the information so far, it's likely your query failed due to an error and there is no data at all.
  25. What do you think the following line of code does? - $data[] = $row[0];
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.