Search code examples
phpsqlmysqlmysql-error-1064

Does anyone see anything wrong with this? Mysql+PHP Error


I'm running the following line :

mysql_query("INSERT INTO tags 
                SET tag = '".$onesearch."',  
                SET date = '".date('d-m-Y')."'") or die(mysql_error());

...and its dieing saying this:

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 'SET date = '29-08-2010'' at line 1

I can't figure out what's wrong.


Solution

  • Remove second SET from your insert query. it should like be:

    mysql_query("INSERT INTO tags 
                    SET tag = '".$onesearch."',  
                    date = '".date('d-m-Y')."'") or die(mysql_error());