Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. $query = "SELECT * FROM profileInfo_choose WHERE user_id='{$username_id}'"; $result = mysql_query($query); $i = 0; $num_fields = mysql_num_fields($result); while ($i < $num_fields){ $field_name = mysql_field_name($result, $i); // your code that uses the field name here... $i++; }
  2. liamoco, while it is possible that the code you posted is just an example, if your real code is nesting a mysql_query() like that and then using a loop to execute that code several time, please be advised that doing that is a processing hog and will make your web host unhappy with you. You should not execute the same query in a loop (or even related queries that differ in only what they retrieve) and you should not nest a mysql_query() in another function call since it prevents using any error checking logic that a real application needs.
  3. If you use HTML <pre> </pre> tags around your print_r() statement, the output will be formatted and easier to read - echo '<pre>',print_r($your_array,true),'</pre>';
  4. You would need to adapt your code that processes an uploaded image and put it inside the foreach(){... code that is executed for-each uploaded file ...} loop. And your query empty error is because you are setting the $sql variable inside of a conditional statement that is evaluating as FALSE, while your code that uses $sql is being executed unconditionally and $sql variable is empty, ergo the query is empty error.
  5. See example #3 at the following link for how you define multiple input fields and how you can loop over them in the php code - http://us.php.net/manual/en/features.file-upload.post-method.php
  6. If you find a post is being viewed, but getting no responses, it is a pretty good indicator that no one understands it. Posting an example of your data (or fake data), with the expected output, and the incorrect output, would be worth a 1000 words.
  7. Something prior to that point is causing the problem. Post at least 10 lines of code (not counting blank lines) leading up to that line.
  8. H:i:m is hours, minutes, month
  9. ^^^ Until someone tries to upload a file that is greater than the upload_max_filesize or the post_max_size. Your code must test if the upload worked before attempting to access any of the unloaded file information.
  10. Your code really has no upload error checking in it and testing if the filename is not empty doesn't tell you that the upload actually worked (you also don't have ALL the code that is processing the uploaded file dependent on the filename being not empty.) Just to see what you are getting, if anything, add the following lines for debugging purposes - echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>";
  11. ^^^ The extension checking code needs a strtolower() thrown in to account for letter-case differences between the actual file extension and the approved list. I recommend that your error messages ALSO echo the supplied value that failed the test as part of the error message so that you can see what value your code is actually using.
  12. The name=" ... " attribute you are using in your form is not the same one you are testing in your php code. Also, I think you missed sasa's last post where he put quotes around the type=, name=, and value= attribute parameters to make the HTML valid.
  13. What does the phpinfo() output show for Loaded Configuration File? <-- That's the php.ini that php is using. If it is blank, meaning no php.ini, then php is using the default values for all the settings. If it is the php.ini that you have been changing, have you stopped and started the IIS service to get any changes made to the php.ini to take effect? Also, if the syntax you are using is invalid, the value won't take effect.
  14. Either your form is invalid HTML or your php code is overwriting the values. You would need to post both your complete form code and the php form processing code to get the quickest solution.
  15. When you do a 'view source' of the page in your browser, what do you get?
  16. The thousands comma separators are a human convention to make numbers easier to read and have no meaning to a computer when used in a number. Well actually they do have some meaning, they are a stop-character, i.e. a character that is not a numeric digit or a decimal point. A computer sees your example as .093 * 1(stop-character) which equals .093 You will need to remove any commas from numbers if you want a computer to operate on that number.
  17. If the format of every value is the same, HH:MM, with leading zeros when necessary to give that exact format, then yes, you can compare time this way.
  18. ^^^ What does that have to do with this thread about approving a comment?
  19. LOL, ^^^. I'll second that. session_register() was depreciated a really long time ago (8 years) when the $_SESSION array was introduced in favor of it, finally throws a deprecated error message in php5.3, and is scheduled to be completely removed in the next major release of php. Don't use any code that is using session_register()
  20. Your for() statement has a comma instead of a semi-colon in it.
  21. A URL is not a file system path. They are completely different things.
  22. It should be: !=
  23. Is your error_reporting really set to E_ALL or greater? Have you actually checked what it is using a phpinfo() statement? If a header() redirect doesn't work, either YOU ARE sending output before it, in which case there would be Warning message OR you are redirecting back to the same page where your header() statement is at. You also need an exit; statement after just about every one of the header() redirects in the code you posted to prevent the remainder of the code on the page from being executed while the browser performs the redirect. All a hacker needs to do in ignore the redirect your code is sending and he can access the 'protected' content on your pages because php continues executing the code on a page until it reached the end of the page or it reaches an exit/die statement. Edit: Also, if you are doing this on a system with output_buffering turned on in your php.ini, you won't see any errors on the page from the error_reporting/display_errors settings when there is an action that clears the buffer.
  24. You should be developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you by reporting and display9ng all the php errors that occur in your code. You will save a TON of time.
  25. Best guess is you are using a URL in your include statement. That does not include the code in the included file into the current program's scope and so does not make variables in the main program scope available in the included code. Second best guess, you are expecting a main program variable to be available in the local scope of a function definition and they are not. Posting actual code that demonstrates/duplicates the problem is the quickest way of getting help.
×
×
  • 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.