this was my query how it looked like:
Code:
$sql = "INSERT INTO my_table(this and,this) values ('$this','$and','$this')";
$result = mysql_query($sql ,$database);
$result = mysql_query($sql ,$database);
i kept looking at my query to see if there were any errors, but i didn't catch anything wrong.
So i finally had to do something, i put the mysql_error() to display (or show) if there were any errros on my MYSQL query. so i changed the code to this:
Code:
$sql = "INSERT INTO my_table(this and,this) values ('$this','$and','$this')";
if($result = mysql_query($sql))
{
echo "<h1>SUCESS</h1>";
}
else
{
echo "ERROR: ".mysql_error()."<BR>";
}
if($result = mysql_query($sql))
{
echo "<h1>SUCESS</h1>";
}
else
{
echo "ERROR: ".mysql_error()."<BR>";
}
so now when i ran my script, i got it to display the error, and this is what it said:
Code:
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 'and, thisp at line 3
GOTCHA!! did you see my mistake? if you notice on my $sql after my_table(this i need to put a comma after "this" so this is how my $sql shoule look like:
Code:
$sql = "INSERT INTO my_table(this,and,this) values ('$this','$and','$this')";
$result = mysql_query($sql ,$database);
$result = mysql_query($sql ,$database);
After I corrected this, the script was able to insert all the data from my from into mysql database.
Quote:
1064 you have an error in your sql syntax you have an error in your sql syntax near 1064 you have an error in your sql syntax near you have an error in your sql syntax check you have an error in your sql syntax php forum you have an error in your sql syntax php 1064 you have an error in your sql syntax check sql order by order by syntax php syntax sql tutorial sql update sql delete sql count syntax database select sql sql where sql date sql set update syntax sql database select syntax sql function sql tables sql property of wallpaperama.com query delete syntax user error sql create sql table count syntax set syntax syntax tutorial table syntax syntax function create syntax where syntax date syntax sql server script syntax query syntax module error you where where have mysql_error php mysql_error die mysql_error or die mysql_error insert into mysql_error in lmysqlclient order by phpmyadmin mysql_query php fopen localhost _get _post smarty isset zend gcc postgresql echo innodb url syntax null apache blob mail scripts javascript foreach xml perl pear php5 redirect auto_increment explode odbc var php4 include array db arrays sessions cookie parse linux timestamp database string property of wallpaperama.com date tables query script functions select session variables delete header tutorials id insert values table login ini variable connect howto post password function documentation print create update tutorial empty class count if set user read server simple form field replace row connection limit example output get multiple return where 4.1 into MYSQL Query Errors mysql query error mysql query browser error syntax error missing operator in query expression syntax error in date in query expression syntax error in query incomplete query clause query of queries syntax error syntax error in string in query expression error executing database query macromedia property of wallpaperama.com sqlserver jdbc driver syntax error in query expression microsoft access driver syntax error missing operator in query expression syntax error in string in query syntax error in query 1064 you have an error in your sql syntax you have an error in your sql syntax you have an error in your sql syntax near sql syntax error microsoft odbc sql server driver syntax error or access violation 1064 you have an error in your sql syntax near sql server syntax error converting datetime from character string error in your sql syntax near engine myisam you have an error in your sql syntax php forum error in sql syntax odbc sql server property of wallpaperama.com driver count field incorrect or syntax error sql server syntax error converting the varchar value error in your sql syntax odbc sql server driver syntax error or access violation you have an error in your sql syntax php microsoft odbc sql server driver sql server syntax error mysql insert into insert into query mysql alter table mysql order by mysql auto increment mysql primary key mysql temporary table property of wallpaperama.com mysql foreign key sql server syntax error mysql left join mysql not null mysql reference manual query alter table 1064 you have an error in your sql syntax check odbc sql server driver syntax error error in your sql syntax near syntax error missing operator in query left join query order by query not null query you have an error in your sql syntax check