Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
mysql syntax error in insert into table query?
I am trying to insert data to a table and keep getting a syntax error ....
[look for the current manual for your version of mysql ....bla bla blas ... near line 1]
I have echoed the values are variables and they print out fine before this statement.
this is day number 2 trying to find the error? any help with this would be welcome
'mysql_query("INSERT INTO 'giacones'
(catagory,itemname,discription,price,itemnumber)
VALUES
($catagory,$itemname,$discription,$price,$itemnumber)")
or die(mysql_error());
2 Answers
- RatchetrLv 710 years agoFavorite Answer
You don't want to use 's around your table name. You can use ` (back tick):
`giacones` or in most cases you don't need to use anything around the table names.
You DO need to use 's around your values, for any value that is a string type (numbers don't need them).
So you would want: ( '$catagory' , '$itemname' ,...
- grippLv 45 years ago
Create table: create table verify (identification int no longer nul auto_increment generally happening key, digital mail varchar(50)) verify whether consultation includes value or no longer. <?Hypertext Preprocessor if($_SESSION['digital mail']!='') { $digital mail=$_SESSION['digital mail']; } if(isset($_POST['post'])) { mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('db') or die(mysql_error()); $q=mysql_query("insert into verify values('','".$digital mail."')") or die(mysql_error()); if($q) { echo'Values are inserted'; } else { echo'Values at the instant are not inserted'; } } ?>