Jump to content

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/211618-notice-query-failed/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103157
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103177
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103183
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103193
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103204
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1103210
Share on other sites

  • 4 months later...

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.  ;)

Link to comment
https://forums.phpfreaks.com/topic/211618-notice-query-failed/#findComment-1152609
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.