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.
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 5 years ago.
Improve this question
I'm getting the following SQL error:
You have an error in your SQL syntax; check the manual
that corresponds to your MariaDB server version for the
right syntax to use near `classxii`.`email`='rajdeep#gmail.com', `classx`.`email`='rajdeep#gmail.com' at line 5
My PHP code looks like:
$sql = "UPDATE `graduation`, `classxii`, `classx` SET `university`='$university', `college`='$college', `course`='$course', `branch`='$branch', `year`='$year',
`school1`='$school1', `board1`='$board1', `percentage1`='$percentage1', `year1`='$year1',
`school2`='$school2', `board2`='$board2', `percentage2`='$percentage2', `year2`='$year2'
WHERE `graduation`.`email`='$email', `classxii`.`email`='$email', `classx`.`email`='$email'";
$res = mysql_query($sql) or die(mysql_error());
What could be the issue here?
You need to change commas to AND in your where part of the statement:
WHERE `graduation`.`email`='$email' AND `classxii`.`email`='$email' AND `classx`.`email`='$email'";
Or if searching only one of them use OR:
WHERE `graduation`.`email`='$email' OR `classxii`.`email`='$email' OR `classx`.`email`='$email'";
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.
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)");