[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: insert question
From:       Michael Dykman <mdykman () gmail ! com>
Date:       2009-02-25 1:57:12
Message-ID: 814b9a820902241757u32426e6dsbf75783fb535bdd1 () mail ! gmail ! com
[Download RAW message or body]

On Tue, Feb 24, 2009 at 8:53 PM, PJ <af.gourmet@videotron.ca> wrote:
> Is there a way to insert several rows into a table with one statement?
> I have this:
> $sql2 = "INSERT INTO authors
>                    (first_name, last_name, ordinal) VALUES
> ('$first_nameIN', '$last_nameIN', '1')";
>        $result2 = mysql_query($sql2, $db);
>
> I want to avoid doing another insert like:
> $sql3 = "INSERT INTO authors
>                    (first_name, last_name, ordinal) VALUES
> ('$first_name2IN', '$last_name2IN', '2')";
>        $result2 = mysql_query($sql2, $db);
>

$sql2 = "INSERT INTO authors
       (first_name, last_name, ordinal) VALUES
       ('$first_nameIN', '$last_nameIN', '1'),
       ('$first_name2IN', '$last_name2IN', '2')";


-- 
 - michael dykman
 - mdykman@gmail.com

 - All models are wrong.  Some models are useful.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql-marcsub@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic