Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I have a table with two fields. One of these fields (ncatalogNumber) contains a string that sometimes begins with \ followed by a 10 digit number. I have been trying to use a MySQL update based PHP query string to replace these backslashes with ''.
If I issue the mysql query directly to the MySQL server it works fine, but as a query string in PHP it is giving the following error:
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 ''\', '')' at line 1
Here is my PHP query string:
$query3 = "UPDATE ndrive SET ncatalogNumber = replace(ncatalogNumber, '\\', '')";
I can't simply delete the first character of the string as sometimes it is a number and not a troublesome back slash.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
This is my code:
UPDATE post SET pagetext = replace(pagetext, 'hiiiiiii','lol')
But it doesn't work and I get the following error:
#1064 - 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 ''hiiiiiii''lol') FROM post WHERE' at line 1
Any ideas?
MySQL server version for the right syntax to use near ''hiiiiiii''lol')
^
Look close, you dont have a comma between those parameters and because of that your string becomes invalid having 2 quotation marks inside.
It appears there was a problem with phymyadmin, the query is indeed correct.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I really don't understand why this query gives me an error in Mysql
UPDATE gallery_photos SET photo_title='Velato stupore' photo_link='http://path/to/img.jpg' WHERE photo_id='27'
phpmyadmin says:
#1064 - 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 'photo_link='http://path/to/im
You are missing a comma:
UPDATE gallery_photos SET photo_title='Velato stupore', photo_link='http://path/to/img.jpg' WHERE photo_id='27'
UPDATE gallery_photos SET photo_title='Velato stupore',photo_link='http://path/to/img.jpg' WHERE photo_id='27'
Use this
It is a punctuation issue, you are missing comma between the columns to set
UPDATE gallery_photos SET photo_title='Velato stupore', photo_link='`http://path/to/img.jpg`' WHERE photo_id='27'
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
$query="UPDATE weapons SET Name='".$_POST['Name']."' , WeaponCategory='".$_POST['WeaponCategory']"' WHERE ID=.$_POST['ID']";
In my code is an error. But i can't see what the problem is?
The error is :
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 ''2' at line 1
AND is used to concatenate logical conditions in WHERE clauses, not to separate field/value pairs in UPDATE statements. Use a comma instead:
UPDATE weapons SET Name='GOL MAGNUM', WeaponCategory='1 Assault Rifles' WHERE ID='2
Also, while pasting that I just noticed the error at the end:
ID='2
If ID is numeric, get rid of the single quote. If it's character, close the quoted string. Using just one quote like that is also a syntax error.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am unable to insert integer data from insert statement.
$value = $_POST[from];
$query = mysql_query("INSERT INTO trip(tripid,from)VALUES(NULL, $value)");
Here from is integer value, but i am getting syntax error as :
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'from)VALUES(NULL, 1)'` at line 1.
from is Reserved Words in MySQL http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-5.html
try this
mysql_query("INSERT INTO trip(tripid,`from`)VALUES(NULL, $value)");
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have the below code running and cannot find what the error is. Can anyone suggest anything I should check?
$result = mysql_query("SELECT * FROM table") or die (mysql_error());
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 'table' at line 1
table is a reserved keyword, you must escape it with backtick.
SELECT *
FROM `table`
MySQL Reserved Keyword List