Re: Re: SQL Insert INTO question

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

 



In full agreement here. I scratched my head this morning, then looked up
"INSERT" in the MySQL Docs for a sanity check. It must be an UPDATE
statement to work as indicated below.

David

<< Sorry David Mitchell >>

==========================================================================

Is that a syntax supported by MySQL?  That is, an INSERT with WHERE clause?
I tried it against Oracle, and it doesn't work (can you imagine how
upsetting it would have been to have learned that, after having worked with
SQL for several years, one can do an update using an INSERT statement?).
I'm pretty sure it doesn't work against MS SQL Server, DB2, etc (not 100%
certain, but 99.9%).

On 12/8/05, El Bekko <elbekko@xxxxxxxxx> wrote:
>
> geekgirl1 wrote:
> > First time poster.....
> >
> > This is the problem.  I want to add the value of $_POST[review] to the
> > reviews table where the unique id from the reviews table equals the
> > review id on my form.  The statement below does not work.  Should I
> > use UPDATE instead?
> >
> > "INSERT INTO reviews (review_txt)
> >       VALUES
> >       ('$_POST[review]') WHERE review_id = $id";
> >
> > Marian
>
> "INSERT INTO reviews (review_txt)
>        VALUES
>        ('$_POST[\'review\']') WHERE review_id = '$id'";
>
> There, now it should work :)
>
> --
> 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