Daimler Posted August 24, 2010 Share Posted August 24, 2010 Hi, i receive today a message from one of my users..i have a new kind of error on my website: Notice: Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id=1' at line 1 SQL: UPDATE class_users SET WHERE id=1 in ../public_html/includes/classes/database/mysql.php on line 133 The line 133: ' SQL: '.$sql); The code: /** * Returns an instance of MySQLResult to fetch rows with * @param $sql string the database query to run * @return MySQLResult * @access public */ function query($sql) { if (!$queryResource=mysql_query($sql,$this->dbConn)) trigger_error ('Query failed: '.mysql_error($this->dbConn). ' SQL: '.$sql); $this->counter++; $mysql = new MySQLResult($this,$queryResource); return $mysql; } Please help Thanks Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/ Share on other sites More sharing options...
shlumph Posted August 24, 2010 Share Posted August 24, 2010 You're not setting any rows in your query; the following will draw a syntax error. UPDATE class_users SET WHERE id=1 Needs to be something like: UPDATE class_users SET first_name='Roger' WHERE id=1 Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103153 Share on other sites More sharing options...
Pikachu2000 Posted August 24, 2010 Share Posted August 24, 2010 Read the error message: UPDATE class_users SET WHERE id=1. SET what WHERE id=1 ? There would have to be a variable that isn't getting a value assigned somewhere. The code you posted doesn't contain the actual query, so that's about as far as I can take it. On another note, you shouldn't let a mysql_error() message output to the browser on a live site. It gives potential hackers too much information. Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103157 Share on other sites More sharing options...
Daimler Posted August 24, 2010 Author Share Posted August 24, 2010 were can i find that line ? sorry i am a beginner Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103158 Share on other sites More sharing options...
shlumph Posted August 24, 2010 Share Posted August 24, 2010 There is probably a logical error somewhere before calling the query() function. Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103160 Share on other sites More sharing options...
Daimler Posted August 24, 2010 Author Share Posted August 24, 2010 is there any way to hide that error? Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103164 Share on other sites More sharing options...
Pikachu2000 Posted August 24, 2010 Share Posted August 24, 2010 Did your user copy/paste that error message to you in an email or did you pull it from the PHP error log? If a user sent it, that isn't even the code fragment causing the error, since it doesn't output the error message to the browser. Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103177 Share on other sites More sharing options...
Daimler Posted August 24, 2010 Author Share Posted August 24, 2010 no a user told me he cant upload some pictures..i fix that problem and i found this error on some page and now i want to fix it or at less hide it if its possible. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103178 Share on other sites More sharing options...
Pikachu2000 Posted August 24, 2010 Share Posted August 24, 2010 Ah, OK. I made the mistake of assuming the user had emailed the error to you. That function uses trigger_error(), so the error wouldn't be output to the browser anyhow. As far as fixing it, you'd need to post the code that called the function when it produced the error. Were there any other errors in the log at the same time related to undefined variables or the like? Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103183 Share on other sites More sharing options...
PFMaBiSmAd Posted August 24, 2010 Share Posted August 24, 2010 That function uses trigger_error(), so the error wouldn't be output to the browser anyhow. What makes you think that? Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103185 Share on other sites More sharing options...
Pikachu2000 Posted August 24, 2010 Share Posted August 24, 2010 Uh, yeah, you're right. I should rephrase that. If the script is designed well, that error shouldn't be output to the browser, it should be logged. Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103186 Share on other sites More sharing options...
Daimler Posted August 24, 2010 Author Share Posted August 24, 2010 well can i do something ? remember i am a beginner im not so good at php and stuffs thanks Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103187 Share on other sites More sharing options...
Pikachu2000 Posted August 24, 2010 Share Posted August 24, 2010 We can try to help you fix it. Do you know what script was running when this error occurred? Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103192 Share on other sites More sharing options...
PFMaBiSmAd Posted August 24, 2010 Share Posted August 24, 2010 Tracking down the code that is producing the query doesn't actually have much to do with programming. It's kind of like trying to find your car in the mall parking lot. You just keep looking for cars that are the same make, model, and color of your car until you find the right one that your key works in. You must use a programming editor (most have a search in file(s) option) to globally search through your files looking for calls to that query() function with a query that has the parts that were printed in the error message until you find the correct code. Is this an open-source third-party script that you could share a link to the author's site (and a version number.) Perhaps someone could find the offending code for you. Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103193 Share on other sites More sharing options...
Daimler Posted August 24, 2010 Author Share Posted August 24, 2010 The script i use is 68 classifieds and i dont know whats the problem with it Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103199 Share on other sites More sharing options...
Pikachu2000 Posted August 24, 2010 Share Posted August 24, 2010 In addition, a link to your website would probably be helpful. If you know what the user who reported the error was doing at the time the error occurred, that would be even better. Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103202 Share on other sites More sharing options...
Daimler Posted August 24, 2010 Author Share Posted August 24, 2010 http://anuntoferta.ro/usercheckout.php Here is my site I think there is a problem because the site is in romanian language. You must fallow and complete all that steps to get the error. you will filnd the errot at the last step. PS. you need to create an account to add free ads. Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103204 Share on other sites More sharing options...
PFMaBiSmAd Posted August 24, 2010 Share Posted August 24, 2010 You didn't post a link to the author's site, but if the script is this - http://www.68classifieds.com/pricing/ it's a purchased script, it's also likely encrypted, it comes with support, and there's not likely anything anyone here can do for you. If that script is building an UPDATE query that doesn't properly make the SET x=y in it, you should take the issue up with the author of the script. Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103210 Share on other sites More sharing options...
Blair Posted December 29, 2010 Share Posted December 29, 2010 Sorry to bump an old thread but since this mentions 68 Classifieds, I wanted to clarify a couple of things. Firstly, thanks for your attempts to help this user. However, as PFMaBiSmAd pointed out, 68 Classifieds is a purchased script and we offer support to our customers. Unfortunately, this guy is using an outdated, warez copy of our script and won't receive support from us. That's why he's come here. Had he been a customer, this would've been resolved quickly. Secondly, regarding encryption - our script includes only two files that are encrypted. These files handle licensing (so that we are able to dedicate our time supporting our legitimate customers). Again - sorry for bumping an old thread but since this is out on the web, I wanted to add my two cents. Quote Link to comment https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1152609 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.