Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. No, that's only an example. Just supply the parameter with the string value you want to get the constant value of - echo constant("CONSTANT_$var");
  2. constant
  3. Because PDFlib requires the purchase of a license for commercial use, you should instead look at the free alternatives (they are linked to in the php.net PDF section of the documentation.)
  4. If you always want to process all the items, you should just remove all the lines of code related to $count, don't forget the closing } that matches the if($count > 0){ line.
  5. Based on the comments in the code, $count is being used to limit the number of items to display/process. If that is so, the query logic should be inside of the if($count > 0){ ... } logic, not outside of it.
  6. The error is because your logic for $count is wrong. You only use mysql_real_escape_string() on the description when if($count > 0){ If you look at your queries, you will see that the first three queries are correct, but after that they reuse everything but the description because the if($count > 0){ logic causes the code that is setting all the other values and using mysql_real_escape_string() on the description is being skipped over.
  7. It would be helpful if you echoed $query for a value that is failing and post the actual query along with the actual msyql_error() message that you get for that query.
  8. Are you developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to on so that all the errors that php detects will be reported and displayed? You will save a ton of time. Also, are you using mysql_insert_id() AFTER you have executed an INSERT query? That's the only time it holds a valid value.
  9. HTTP_REFERER provides no real security. Web proxy scripts and spam bot scripts set it to match the site being requested. You would need to set a session variable when your form is produced and check that it is set in the form processing code. Unset the session variable in your form processing code so that only one submission can be made for each visit to the form. This will at least require that something visits your form before submitting to your form processing code and supports passing the session id between pages.
  10. You are apparently using some url rewriting. Best guess is that the rewrite rule is not passing the get parameters on the end of the actual url being requested.
  11. We can only help you with specific errors. If you want help with the code you posted above, you would need to post the error as well. A lot of the php information posted on the Internet is there solely to earn the site money though advertising/link clicking... Many don't care if the code they have posted on their site works or produces errors. There were a few fundamental changes in php around 8 years ago and a lot of the scripts posted around on the Internet have never been updated or removed. It is really sad when we see someone trying to get help in the forum because they found code that was so out of date.
  12. Use the msyql MONTH() function directly in your query. You will need to get the Unix Timestamp into a usable DATE format (why do people still bother to use a Unix Timestamp.) See the mysql FROM_UNIXTIME() function to do that. Untested but should work - $month = 9; // the month you want to find $query = "SELECT * FROM your_table WHERE MONTH(FROM_UNIXTIME(your_Unix_Timestamp_column)) = $month"; If you want the current month, you could do that directly in the query - $query = "SELECT * FROM your_table WHERE MONTH(FROM_UNIXTIME(your_Unix_Timestamp_column)) = MONTH(CURDATE())";
  13. The same method can be performed using php code.
  14. To find the closest to a value, you take the absolute value of the difference between the current value and the values in question. If you order the results of that in ascending order, the smallest value will be the same or closest to the current value. Untested, but should work - SELECT *, ABS(UNIX_TIMESTAMP() - your_date_column) as diff FROM your_table ORDER BY diff LIMIT 1 Edit: If your columns are actually a DATE or DATETIME, instead of the unix timestamp you showed in your first post, you would alter the above query to use the TIMEDIFF() function and either NOW() or CURDATE() inside of the ABS() function.
  15. The mysql query log (assuming it is on) shows the actual queries. It does not show the result. The mysql error log only shows server errors, not query errors (as far as I can tell when I tested with queries that produced things like duplicate keys, queries without data for fields that don't have defaults values...) Query errors are application level information and it is the responsibility of the application to handle them.
  16. The 4th parameter of mysql_connect() is NOT the database name. You must use mysql_select_db()
  17. Temporarily change your or die(...); statement to the following to find out why the query is failing - or die(mysql_error());
  18. The single-quote is breaking your HTML (if you do a 'view source' in your browser you will see all the data is there.) When you output content (that is not intentionally HTML) on a web page, you need to use htmlentities with the second parameter set to ENT_QUOTES.
  19. WHERE fid BETWEEN 1 AND 15
  20. Your application code (php) should have error checking and error reporting logic in it. That logic would then be logging problems or making use of php's built in error logging through a function like trigger_error
  21. The only limit, as far as php is concerned, is the amount of memory available. There are 'security' patches that could impose such limits and your web host might be using it/them. Start by checking if your php script is receiving what you expect. Add the following to your php code - echo "<pre>"; echo "POST:"; var_dump($_POST); echo "</pre>"; Php does impose a maximum size of all the post data using the post_max_size setting (AFIAK exceeding this will result in an empty $_POST array, not simply data cut off at some point.) The default post_max_size setting is 8M.
  22. The error message you posted is because mysqli_error() expects the mysqli link as a parameter. Had you used the mysqli_error() function correctly, the resulting msyql error would have told you the query was failing due to a duplicate index value.
  23. It's likely that the short open tag you are using is causing your connection code to not be seen as php code. What do you get when you do a 'view source' in your browser when you goto the login.php page?
  24. $_SERVER['DOCUMENT_ROOT'] is not setup properly on your server. You would need to speak with your web host to get it corrected. It is set to /ext/default/ For your account, it should be set to your document root folder, which looks like it should be /ext/f/fo/fourthelement.com/html/
×
×
  • 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.