Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. You need to - A) Use trim() when the data is inserted into the database to prevent any future problems, and B) UPDATE the values in your account column using trim() to remove the white space that is already present.
  2. Best guess at this point is that you have some non-printing characters (null, line-feed, tab...) that are part of the $fund, $account, or $year values and they don't match what is in the database but when you copy/paste the printed output and use it in phpmyadmin, the non-printing characters as no longer part of the values. This is actually why I asked for the var_dump() of the $query2 variable above, to see if the length of the printing characters matches the actual length of what is in the variable.
  3. The only reason you are getting a 1 when you entered the value 1,000,000 is that the comma is a STOP character and the number was not parsed beyond that point when it was entered. Use a DECIMAL data type.
  4. The or die(mysql_error()); on the mysql_fetch_row() line of code has no meaning because mysql_fetch_row does not set a mysql_error(). The only result you would get from the or die() would be for your code to stop execution with nothing being output by that statement. Remove the or die() - $row2=mysql_fetch_row($result2)or die(mysql_error()); It would sure help if you posted the output you are getting. What does print_r($row2); actually show? What does the following show right after the line where $query2 is being set - var_dump($query2); What does adding the following two lines of code immediately after your first opening <?php tag on the page show - ini_set("display_errors", "1"); error_reporting(E_ALL); And since you happen to be using $_SESSION variables (it pays to show us everything you are doing on the page as it can be relevant to problems you are having on a page), what does a phpinfo() statement show for the register_globals setting? And if register_globals are ON, do any of your $_SESSION variables have the same name as any of your program variables.
  5. When you display it, you format it with the 1,000 thousands separators. There is both a mysql FORMAT() function that you can use in a query and a php number_format() function that you can use in your presentation logic.
  6. For the queries you posted, there is no need to execute two different queries - SELECT *, LEFT(content, 100) AS short_version FROM snews WHERE id='1' ORDER BY id2 LIMIT 0, 5
  7. To show all php errors, add the following two lines of code immediately after your first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL); The normal action of trigger_error() won't show anything on a majority of the php systems in use.
  8. Best guess, since you did nor provide any specific details about the redirects that are working and the one(s) that are not, is that you are either changing the hostname (subdomain) or the path in the URL and the session cookie settings are not setup to match a different hostname/path then where the cookie was created. Second best guess, sessions are not working on the page you are redirecting to.
  9. Live web servers often have disk caching setup with long TTL (time to live) settings that prevent checking for file changes. You would need to output no caching settings for all your files and then wait for the cache to be cleared out so that the no caching setting applies. You should be learning php, developing php code, and debugging php code on a local development system. You will save a ton of time in the development cycle.
  10. Where are you testing this? A local PC? Live web hosting?
  11. Thats because you are not providing any relevant information. We are not standing right beside you, so unless you tell us what error, symptom, or problem you are having when you try your code, no one can help you.
  12. Is your code executing the following line and outputting the success message? - echo "Image successfully uploaded<br />"; It's likely that the move_uploaded_file() is failing, but again the code is not doing enough error checking or error reporting to get it (your code) to tell you what it is doing. You need an else {} statement and a meaningful user message when the move_uploaded_file() function fails to move the uploaded file. Add the following two lines of code immediately after your first opening <?php tag to get php to display all php errors - ini_set("display_errors", "1"); error_reporting(E_ALL);
  13. Any type="file" form field that is left empty will produce an error value of 4. If your file input(s) are optional, you would need to test in the error handling if the error is a 4 and basically ignore it and continue. For debugging display exactly what data is being submitted to your page - echo "<pre>"; echo "GET:"; print_r($_GET); echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>";
  14. The HTML being output by the following line is invalid - echo "<option value=$monster_name[$x]>$monster_name[$x]</option>"; The value='...' attribute needs to be enclosed in quotes to make valid HTML (and in fact everyone should be validating their resulting web pages at the w3.org validators to insure that they contain valid HTML/CSS.)
  15. What are the actual errors, symptoms? Post actual error messages, identify lines where the error is being reported... You haven't exactly proven that your code is not working. The posted code looks like it should work, so best guess at this point is that the actual code being executed is not the code you are looking at or posting and asking us to look at.
  16. Then that is not your whole actual relevant code. You probably have that code inside of a loop and variables are being reuse.
  17. What does adding the following right after the line with the mysql_query() statement show - echo mysql_num_rows($result3);
  18. That WOULD at least eliminate the need to learn how to write and use functions correctly.
  19. A mysql DATE data type has a format YYYY-MM-DD, not MM/DD/YYYY. DATE values are strings and must be encompassed in single-quotes in the query. When they are not enclosed in single-quotes, they are a math expression (the correct YYYY-MM-DD format is a subtraction math expression and the format you are attempting is a division math expression.)
  20. How about in the official documentation - http://us2.php.net/manual/en/functions.arguments.php
  21. The error messages you display when validating external data should also display the value that failed so that you get feedback as to why the validation test failed. How else would you know why the test failed?
  22. In mysql you would do the following (unknown if there is equivalent in ORACLE) - SELECT calldate, SUM(count_pnums) AS total, filenumber FROM tablename WHERE calldate BETWEEN '$sDate' AND '$eDate' GROUP BY calldate, filenumber
  23. You execute one query that retrieves the rows you want in the order you want, then you just iterate over the rows in your php presentation code. (a) You can do all the sorting in the query (which uses the complied code of database engine to do the work.) There is no need to use some slow parsed, tokenized, interpreted php code to do any sorting. (b) It can be done in a single query.
  24. Your code has some error checking (test if the values are what you expect), but it has no error reporting (output meaningful user error messages that tell you why it did not work or what values were unexpected.) Every one of your if(){} conditional tests that is checking some aspect of the external data NEEDS an else {} statement that outputs as much information about why the if(){} test failed. If $_FILES[$img] is not set, output a user error message telling you (that condiation actually indicates you have exceeded the maximum post size setting). If $_FILES[$img]['error'] is greater than zero, out what value it is so you can troubleshoot which upload error is occuring. if $_FILES[$img]['type'] is not one of the allowed values, display what value was received, perhaps one browser type is sending a mime type that is perfectly valid for the type of file and you should add it to your list. If the size $_FILES[$img]['size'] is too large, output a user error message stating that is the reason why the file was not processed. You might want to look at the following post for more error checking and error reporting ideas, because for all we know uploads are not enabled on your live server - http://www.phpfreaks.com/forums/index.php/topic,278952.msg1320835.html#msg1320835
  25. echo accepts a comma separated list of parameters, so the commas are not necessarily the cause of the problem.
×
×
  • 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.