PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Error: Could not perform MySQL query -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 ' LocationID=0 WHERE (ItemID=4)' at line 11
At first glance, I notice that you don't need the parentheses around the where clause. Also for some entries you don't have the escaped ', where in others you do. That's probably generating the error, and that's why I use heredocs.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Error: Could not perform MySQL query -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 ' LocationID=0 WHERE ItemID=3' at line 11
I've removed the "" from the ItemID, I initially tried it with that but it didn't work, and the ItemID is an int on the database.
I have pasted your extract into the program, it's generating the following error:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in \\nas09ent\domains\s\XXXX\user\htdocs\run2.php on line 4090
That's probably because you've got whitespace before or after the "SQL;" line. The closing of the heredocs has to be the ONLY thing on the line - no whitespace.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
twigletmac wrote:In heredoc you need to use curly brackets around array elements:
In my experience, you don't need to do that around arrays one level deep. By that I mean $my_array['element1'] will parse out, but $my_array['element1']['subemelent1'] wont.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Error: Could not perform MySQL query -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 ' LocationID=0 WHERE ItemID=3' at line 11
I believe your values should be quoted? So instead of LocationID=0 WHERE ItemID=3, it should be LocationID='0' WHERE ItemID='3'