Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL INSERT query syntax error

I am trying to make a mysql insert like this one here

<http://www.w3schools.com/php/php_mysql_insert.asp >  
     INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...) 

I am trying to insert the values below into the table userbase.

54007033331, Codi Y, Male, pub, http://google.com/ggg.jpg


INSERT INTO userbase (id,name,gender,publicity,pic) VALUES (54007033331, Codi Y, Male, pub, http://google.com/ggg.jpg)

MySQL 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 'Y, Male, pub, http://google.com/ggg.jpg)' at line 1

Can anyone please point me in the right direction of how to fix this syntax error?

like image 848
YoYoMa Avatar asked Jul 26 '26 10:07

YoYoMa


1 Answers

You should quote properly string and char values in query.

 INSERT INTO userbase (id,display,gender,publicity,pic) 
 VALUES (54007033331, 'Codi Y', 'Male', 'pub', 'http://google.com/ggg.jpg')

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!