Re: What's wrong with this query?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Viorel Dragomir wrote:

I'm using MySQL for about 2 years and never heard about this kind of INSERT.
Is not SQL compliant neither.

YOU CAN NOT MAKE : INSERT INTO table SET var=1 [as I know]

As a matter of fact it IS possible, according to the MySQL manual on http://www.mysql.com/doc/en/INSERT.html

[snip]
	    INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
        	[INTO] tbl_name [(col_name,...)]
	        VALUES ((expression | DEFAULT),...),(...),...
        	[ ON DUPLICATE KEY UPDATE col_name=expression, ... ]
	or  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
        	[INTO] tbl_name [(col_name,...)]
	        SELECT ...
HERE->	or  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
        	[INTO] tbl_name
	        SET col_name=(expression | DEFAULT), ...
        	[ ON DUPLICATE KEY UPDATE col_name=expression, ... ]
[/snip]

I use this syntax all the time, and always without any trouble.



@Axel:

try this:

$logit = mysql_query("INSERT INTO log SET term='$search', returns='$arrayword', time=CURTIME(), date=CURDATE(), ip='$ip'") or die(mysql_error());

to see what is going wrong...



Erwin Kerk
Web Developer

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux