RE: Re: Looking for more optimal way to do multiple similar inserts at

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

 



Please note that his solution uses a subselect - and your version of
mysql may not support subselects.  Subselects were introduced (I
believe) in Mysql 4.1 


- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-----Original Message-----
From: Sebastian Mendel [mailto:lists@xxxxxxxxxxxxxxxxxx] 
Sent: Thursday, November 11, 2004 6:42 AM
To: php-db@xxxxxxxxxxxxx
Subject:  Re: Looking for more optimal way to do multiple
similar inserts at

// send Messages
$sql = '
INSERT INTO `hf_privmessages` 
(`ownerID`,`fromID`,`toID`,`from_name`,`to_name`,`priority`,`date`,`subj
ect`,`message`,`folder`)
SELECT `userID`                     AS `ownerID`,
        ' . (int) $userID . '        AS `fromID`,
        `userID`                     AS `toID`,
        "' . $username . '"          AS `from_name`,
        `nickname`                   AS `to_name`,
        "' . $_POST['priority'] . '" AS `priority`,
        NOW()                        AS `date`,
        "' . $subject . '"           AS `subject`,
        "' . $message . '"           AS `message`,
        "inbox"                      AS `folder`
WHERE `userID` IN (' . implode( ', ', $_POST['rcvID'] ) . ')
';

-- 
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