insert where

insert where

am 11.06.2007 04:12:00 von lektrikpuke

What is wrong with the below?

$sql=mysql_query("INSERT INTO advertiser_tbl WHERE adv_id='7' (adv_name,
cont_name)
VALUES ('Peter', 'Griffin')");

Re: insert where

am 11.06.2007 10:53:31 von Captain Paralytic

On 11 Jun, 03:12, "Mr. Newt" wrote:
> What is wrong with the below?
>
> $sql=mysql_query("INSERT INTO advertiser_tbl WHERE adv_id='7' (adv_name,
> cont_name)
> VALUES ('Peter', 'Griffin')");

It doesn't match any of the valied syntaxes as shown in the manual:
http://dev.mysql.com/doc/refman/5.0/en/insert.html

Re: insert where

am 11.06.2007 20:39:53 von unknown

Post removed (X-No-Archive: yes)

Re: insert where

am 11.06.2007 23:42:01 von lektrikpuke

Tom wrote:
> On Sun, 10 Jun 2007 22:12:00 -0400, Mr. Newt wrote...
>> What is wrong with the below?
>>
>> $sql=mysql_query("INSERT INTO advertiser_tbl WHERE adv_id='7' (adv_name,
>> cont_name)
>> VALUES ('Peter', 'Griffin')");
>>
>>
>
> The syntax for the INSERT and UPDATE SQL command are a bit different. An INSERT
> is a new entry so there can't be a conditional clause at the end. The syntax for
> that might be...
>
> INSERT INTO advertiser_tbl (adv_name, cont_name)
> VALUES ('Peter', 'Griffin')");
>
>
> For an UPDATE you could use..
>
> UPDATE advertiser_tbl
> SET adv_name='Peter', cont_name='Griffin'
> WHERE adv_id='7';
>
>
> Tom

Thank you. =)