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 'SET =test WHERE =test' at line 1] in EXECUTE("UPDATE SET =test WHERE =test")
$sql = 'UPDATE ' . $this->recipientDbTable . ' SET ' . $this->recipientDbColumn['result_id'] . '=' . 'test' . ' WHERE ' . $this->recipientDbColumn . '=' . 'test';
Asked
Active
Viewed 42 times
0
-
2Look at the *actual* SQL string to see why it contains junk. Then stop doing that string concatenation and [use placeholders for the *values*](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php?rq=1). – user2864740 Sep 01 '15 at 06:45
-
Wrong query! Please try to read the error. – aldrin27 Sep 01 '15 at 06:45
-
I have bro no clue what's even happening ayy lmao – Spidey Sep 01 '15 at 06:47
-
1`echo $sql` would be a 'start'. – user2864740 Sep 01 '15 at 06:47
-
Thanks for your help guys – Spidey Sep 01 '15 at 06:59
3 Answers
0
It looks like $this->recipientDbColumn['result_id']
is null or empty. Look at your error log with error_reporting(E_ALL)
, it may have an Undefined index error.
Also, echo out the actual SQL query and post it here, it should be obvious what the problem is.
Also, use prepared statements.

Matt Parlane
- 453
- 2
- 11
-
-
The syntax of the SQL string is incorrect because he's missed an equals sign. – GordonM Sep 01 '15 at 06:53
-
Echos this over and over UPDATE SET =test WHERE =testUPDATE SET =test WHERE =testUPDATE SET =test WHERE – Spidey Sep 01 '15 at 06:56
-
`$this->recipientDbTable` is empty and `$this->recipientDbColumn['result_id']` is empty. Figure out whey they're empty. – Matt Parlane Sep 01 '15 at 06:57
-
Ok thanks I'll accept the answer and go through my code I'm currently writing a new function so a lot of stuff is probably broken haha – Spidey Sep 01 '15 at 06:59
-
0
$this->recipientDbColumn['result_id']
and $this->recipientDbColumn
as the error suggests return empty string.
... right syntax to use near 'SET =test WHERE =test' at line 1] in EXECUTE("UPDATE SET =test WHERE =test")
As you could see, the call returned empty string. Check the code for where you missed it!

Suhail Gupta
- 22,386
- 64
- 200
- 328
0
According to the error, it seems that your $this->recipientDbTable
& other variables doesn't contains the values.
Try
echo $this->recipientDbColumn;
Check if it prints the values

Harshit
- 5,147
- 9
- 46
- 93