@ 2:39:12 AM on 4/12/01, Brian Clark wrote:

...
> @ 2:13:10 AM on 4/12/01, midget2000x wrote:

...
>> //declare the array
>> $info_request = array (1 => 
>"firstname","lastname","email","howfound","optin","comments","request_type","request_bucket","date");
                         ^^^^

Sorry, I guess this would be more complete:

<?php

$tablename = 'foo';

$info = array(0 => array('billy bob','joe','email','yahoo','sort 
of','foo','firm','large','date'),
              1 => array('james 
j','frank','email','google','no','bar','soft','small','date'));

while(list(,$array) = each($info))
{
   $results = 'INSERT INTO $tablename VALUES(';
   while(list($idx,$value) = each($array))
   {
      $results .= ($idx == (sizeof($array) - 1) ? "'$value'" : "'$value',");
   }
   $results .= ')';
   print "$results\n"; /* INSERT here. */
}

?>

I guess it could be made into a function($info,$table) -- whatever,
but you'd need error checking a returns on the inserts.


-Brian
--
 PGP is spoken here: 0xE4D0C7C8
 Please do not carbon copy me on list replies.



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