Re: What's wrong with this query?
| From: | Erwin Kerk | Date: | Thu, 26 Feb 2004 12:06:15 +0000 |
| Subject: | Re: What's wrong with this query? | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33147@lists.php.net to get a copy of this message | ||
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