INSERT Array Values into mySQL Table
| From: | Rahul S. Johari | Date: | Wed, 02 May 2007 15:42:46 +0000 |
| Subject: | INSERT Array Values into mySQL Table | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-254238@lists.php.net to get a copy of this message | ||
Ave,
Here¹s the thing, I¹ve got an Array which has it¹s own set of Keys =>
Values. I¹m using foreach() to read the Keys => Values like this:
function pr1($var) {
foreach ($var as $k => $v) {
echo ³$k => $v²;
}
I need to INSERT the Values from this array into a mySQL table. The problem
is, There is other data that is going into the same row of that mySQL Table
as well.
So I have to basically insert 3 fields and then the rest of values I have to
insert using this Array. In other words, this is what I have to do:
INSERT into table (f1, f2, f3, f4, f5) VALUES ($1¹, $2¹, $3¹, //and the
rest of the values from from the $v Values from that Array $var.....
I¹m not able to formulate a code to do this. Any help would be really
appreciated.
Thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.
W: http://www.rahulsjohari.com
E: sleepwalker@rahulsjohari.com
³I morti non sono piu soli ... The dead are no longer lonely²