If you want to separate insert statements, you can do it like this:

$big_insert_query = "INSERT INTO table (id, col1, col2) VALUES ('',
'$col1_stuff[$i]', '$col2_stuff[$i]'), ('', '$col1_stuff[$i]',
'$col2_stuff[$i]'), ('', '$col1_stuff[$i]', '$col2_stuff[$i]'), ('',
'$col1_stuff[$i]', '$col2_stuff[$i]')";

Ie, you specify the columns, and the values are a comma separated, bracket
enclosed list.  I dunno whether this frees up any resources, or has any
major advantages, though it's probably better practice ;)

I think this is only available in 3.22 or higher, though I could be
wrong....

James

"Ben Bleything" <[EMAIL PROTECTED]> wrote in message
000801c11895$0d43b7a0$0201a8c0@allegro">news:000801c11895$0d43b7a0$0201a8c0@allegro...
> I _believe_ (not totally sure) that mysql_query() can only handle one
> statement at a time, and if you need to execute multiple, you will need
> to use more than one mysql_query() statements.  It's a bummer =>  I have
> all sorts of problems with it.
>
> What's up with your return e-mail address?  It's a pain in the ass for
> all mails to you bouncing...
>
> Ben
>
> -----Original Message-----
> From: Jacques [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, July 29, 2001 5:47 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Generating mysql statement from php return an error :-(
>
> Hi,
> I'm using a table in my session to store my variable to generate later
> my
> sql statements.
> Until now... nothing very weird !
> But when I want to generate my sql statement. I've got an error after
> the
> first line where I put a comma
> " ; " to make a difference within my statements.
>
>
> this is a portion of my code :
>  $query.="Insert into product
> (id_quote,item,description,quantity,unit_price,ext_price,lead) values
> ('$QUOTE_NUMBER' , '".$TABLE_QUOTE_PRODUCT[$y]["item"]."' ,
> '".$TABLE_QUOTE_PRODUCT[$y]["description"]."',
>   '".$TABLE_QUOTE_PRODUCT[$y]["qty"]."' ,
> '".$TABLE_QUOTE_PRODUCT[$y]["unitprice"]."' ,
>   '".$TABLE_QUOTE_PRODUCT[$y]["extprice"]."' ,
> '".$TABLE_QUOTE_PRODUCT[$y]["leadtime"]."');\n";
>  }
>  $result=mysql_query($query);
>
> If I have only one line in my sql and I remove the ; it works.
> but If I add the ; to separate two sql lines.... error !
>
> Any idea how I can resolve this problem ?
>
> Regards,
> Jacques
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to