Re: excuting several sql statements in one time
| From: | James Holloway | Date: | Thu, 20 Sep 2001 11:21:11 +0000 |
| Subject: | Re: excuting several sql statements in one time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67971@lists.php.net to get a copy of this message | ||
Hey,
Whilst you can't perform statements like this, there are alternatives. If
you only have one field in your table, you can use:
"INSERT INTO com VALUES ('pentium'), ('amd')"; // Continue the comma
separated values list
Or, if you need to specify which fields the data is to go in:
"INSERT INTO com (column1, column2) VALUES ('something', 'something else'),
('something again', 'something else again')";
James
"VM ÁÖ¿N" <seojuyung@hotmail.com> wrote in message
news:F152pgTFur2iz2Mb1s700003145@hotmail.com...
> Hello
>
> I want to know how to implement these several sql statements in one time.
>
> For example, I have 2 sql statements like :
>
> INSERT INTO com VALUES ('pentium');
> INSERT INTO com VALUES ('amd');
>
> Then, I want to excute these 2 sql statements in one time with PHP.
>
> I tried to implement like this :
>
> $query = "
> INSERT INTO com VALUES ('pentium');
> INSERT INTO com VALUES ('amd');
> ";
> mysql_query($query, $dbconnect);
>
> But as you know, it didn't work.
>
> Does any one know how to run this job?
>
> _________________________________________________________________
> MSN Explorer¡Æ¢® AOA¢¬¢¬e Hotmail ¡íc¢¯eAI EI¨úA ¨¡i¢¬RC¨ª Ay¢¥I¢¥U.
> Ao¡¾Y
> http://explorer.msn.co.kr/ ¢¯¢®¨ù¡© ©ö¡ì¡¤a¡¤I
> ¢¥U¢¯i¡¤I¥ìaCI¨ù¨ù¢¯a.
>