Re: INSERT Question
| From: | Charles Kline | Date: | Tue, 01 Apr 2003 02:56:20 +0000 |
| Subject: | Re: INSERT Question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26773@lists.php.net to get a copy of this message | ||
Everything looks okay with this when I echo the sql string:
INSERT INTO tbl_ib_articles (issue_brief,article) VALUES ('24','30'),('24','20'),('24','31')
My question was, what do I need to change to make this an UPDATE?
Thanks,
Charles
On Monday, March 31, 2003, at 08:30 PM, JanetVal@aol.com wrote:
In a message dated 3/31/2003 5:26:36 PM Pacific Standard Time, ckline@rightcode.net writes:
then I built the INSERT like so:
foreach($article_keys as $articleid)
{
$insert[] = "('$v_ib_id','$articleid')";
}
$article_sql = "INSERT INTO tbl_ib_articles (issue_brief,article)
VALUES " . implode(',',$insert);
It's pretty much okay, except you don't have ( ) around the string that you create with the implode. You can echo $article_sql to see exactly what the SQL looks like and you can then modify your statement so you get the right SQL.
Janet