Re: What's wrong with this query?

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

 



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]

Try to search for the INSERT INTO syntax.
You combined INSERT INTO and UPDATE syntax.

Tip for insert: INSERT INTO table(field1, field2) VALUES($field1, $field2)

If your code is totally wrong please read an sql manual first, then try to
post.
Have a nice day

----- Original Message ----- 
From: "Ricardo Lopes" <lopes@xxxxxxxxxxxxxxx>
To: "Axel IS Main" <nfzgrld@xxxxxxxxxx>
Cc: "PHP DB" <php-db@xxxxxxxxxxxxx>
Sent: Thursday, February 26, 2004 11:18 AM
Subject: Re:  What's wrong with this query?


> What is the error? there i something i always do when i have this problem,
> try this:
>
> error_reporting(E_ALL);
> $sql = "INSERT INTO log SET term='$search', returns='$arrayword',
> time=CURTIME(), date=CURDATE(), ip='$ip'");
> echo $sql;
> $logit = mysql_query($sql);
>
>
> This makes all kind of notice about uninitialized variables and other
things
> that may cause problems, great for debugging, and the echo $sql prints the
> sql that is sent to the client, here you can see if one of the variable yo
> are sendding to the query have some kind of problem, like a ' in the
middle,
> which could cause problems in your script.
>
> If you can't see the problem after this post the output of this code.
>
> ----- Original Message -----
> From: "Axel IS Main" <nfzgrld@xxxxxxxxxx>
> To: "PHP-DB" <php-db@xxxxxxxxxxxxx>
> Sent: Thursday, February 26, 2004 9:05 AM
> Subject:  What's wrong with this query?
>
>
> > I've just tried to do something I've done a thousand times. It does not
> > work. I've checked all of the syntax, made sure the field and variable
> > names are correct. No matter what I do it just doesn't work. The table
> > remains empty. Here's the query:
> >
> > $logit = mysql_query("INSERT INTO log SET term='$search',
> > returns='$arrayword', time=CURTIME(), date=CURDATE(), ip='$ip'");
> >
> > Now that doesn't look too difficult does it? Well, apparently it's
> > impossible! I'm really hoping someone out there can see something that I
> > missed.
> >
> > Nick
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
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