Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Comment out or otherwise remove the following line of code -
  2. Given the error message and the posted code, if it ever worked, you have somehow deleted the code that is supposed to be setting $this->host and it is using the default of 'localhost'
  3. You need the correct hostname (something like myslx.your_web_host.com) or the IP address of the correct mysql server for your account. You can usually find this somewhere under your hosting control panel where you created the database/user/password.
  4. If you end up with the escape \ characters stored in the database, then you are escaping the data twice. The \ characters should only exist in the query. When the query is executed, the escaped special characters are treated as the literal un-escaped character and only the special character is inserted. Since it is unlikely that you are intentionally escaping data twice in your code, it is likely that magic_quotes_gpc is ON and php is automatically escaping the data first. If you can, you need to turn off magic_quotes_gpc. However, since you won't always be on a server where you will be able to turn it off, you must actually check if it is on and use stripslashes() first - if (get_magic_quotes_gpc()) { $var = stripslashes($var); } $var = mysql_real_escape_string($var); If your data is never expected to contain a \ character as actual data that someone entered, you could unconditionally use stripslashes() before you use mysql_real_escape_string()
  5. The error means that your query failed due to an error and returned a FALSE value instead of a mysqli_result. For debugging purposes (remove it after you are done), echo mysqli_error($db); on the next line after the mysqli_query() line to find out why the query failed.
  6. http://us3.php.net/is_array
  7. You are likely getting a header() error that is preventing setcookie() from setting the cookie. You should be developing and debugging php 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 both report and display all the errors it detects. Stop and start your web server to get any change made to php.ini to take effect and confirm that the settings were changed using a phpinfo() statement in case the php.ini that you are changing is not the one that php is using.
  8. The posted line of code does not produce a php parse error (unless you don't have a closing } later in the code.) If you really want someone if a forum to help with an error in your code, you need to post the error message with the line number information and you need to post enough of your code up to (syntax errors are often caused by something that the programmer left out prior to the line where the error is being reported at) and including the line where the error was reported at.
  9. What I'm getting at is the 500 error means that an incomplete (or no) response was sent back due to the http request. From a php standpoint, that usually happens when there is a fatal runtime error, which using E_USER_ERROR (with error_reporting/display_errors set to prevent any output) or an empty die/exit statement would cause.
  10. While it might not be a security issue, that something could submit data and get a 500 error means that a legitimate visitor could do so as well. Just from a functional standpoint, I would want to know why I was getting a 500 error on a page(s). Any chance you have any trigger_error('...',E_USER_ERROR) in your code?
  11. It didn't work before either. Just telling us that something doesn't work does not provide any useful information so that someone could actually help. We know it does not work or you would not be posting in a help forum. What does it do v.s. what you expect? What symptoms or errors do you get? We are not standing right next to you, nor do we have access to your server, so you must communicate sufficient information about what you are doing and what happens in front of you when you do it. For all we can tell from the information you have posted, you don't have any matching data or the column is not actually a datetime data type or there is something else wrong in the query and it is producing a sql error...
  12. There's a table of reserved keywords at this link - http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
  13. from is a reserved mysql keyword and requires special handling when used as a column name. You either need to rename your column to something else or enclose it in back-ticks `` every time you use it in a query.
  14. Doesn't that suggest to you that you could compare it directly to the value that now() returns?
  15. now() returns a DATETIME value, which is either a 'YYYY-MM-DD HH:MM:SS' string or YYYYMMDDHHMMSS.uuuuuu numeric format. By putting now() inside of single-quotes in the query, you are making a string consisting of the characters 'n', 'o', 'w', '(', and ')'. Don't put single-quotes around mysql functions. Since now() returns a DATETIME value, you can only compare it with other DATETIME values. UNIX_TIMESTAMP returns a Unix Timestamp, which is not a DATETIME value and cannot be directly compared with the value now() returns. What is the data type of d.dl_end?
  16. Your $query variable is assigned a value, once, which is both before $i has been defined and it is before the loop. The while(){} loop just keeps using the same string that $query was assigned. You need to put the $query = "...." assignment statement inside of the loop if you want it to be evaluated with different values of $i.
  17. You have got two problems. 1) The mssql extension is not loaded, because 2) 000webhost.com does not have any hosting plan that provides a MS SQL server.
  18. That error is indicative of a numeric value that is empty. I recommend forming your query in a variable ($query) so that you can echo the actual query so that you can see what is wrong with it. It's likely that $editGameID is empty (you should be validating all data being put into any query.) You will also have problems with the DATE() functions in the query because mysql expects strings as the parameter in the DATE() function call. You must have single-quotes around the parameter if you are supplying literal values in the query.
  19. You were linked to a solution in the first reply in the thread, 34 minutes after you started it. It does not look like you read it because your two follow on posts were devoid of any hint of actual sql.
  20. So, did you actually try the suggested solution before you decided it did not work?
  21. Since that is not the correct syntax for either the SECOND() function (which won't do what you want) or the TIMESTAMPDIFF() function (which will do what you want), you are going to need to do what the error message suggests -
  22. Yep, that's correct. jw224, using some real indentation in your code will help, so that you can see exactly what code goes with what. And the reason I did not get that error is because that code (Greeting_tree.php) is way out of date and is dependent on register_globals being on, so when I executed it, the offending code was not actually executed. I would hope that collages that were using php in a classroom would be aware of something that was turned off by default over eight years ago and was a huge security hole when turned on and would not be exposing students to any code that was still dependent on register_globals.
  23. You are going to need to use mysqli_error($dbc) (which is guaranteed to work with how you are using mysqli) or $dbc->mysqli_error (which should work) in order to get the msyql error output.
  24. The two pieces of code you posted DON'T produce the error you posted. However, the error does mean that you are including the file where that function definition is at more than once or it is inside of a loop (or perhaps someone configured your server to include the definition prior to your script executing.) It would take seeing all the actual code that resulted in that error to be able to help. Also, since this is not a PHP Installation problem, moving thread to the php help forum section...
×
×
  • 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.