Hi midget2000x,

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

...
> Obviously the code below is impossible, but illustrates what I want to do:

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

> //output the array loop results to a variable
> $array_results = foreach ($info_request As $value) { print "$value,"; }

> //place the output variable into an SQL call (therefore making it
> dynamic):

> INSERT INTO $tablename ($array_results)

How about:

<?php

$info = array (
   "firstname","lastname","email","howfound","optin",
   "comments","request_type","request_bucket","date"
   );

while(list($idx,$value) = each($info))
{
   $results .= ($idx == (sizeof($info) - 1) ? "'$value'" : "'$value',");
}

/* INSERT INTO foo ($results) */

?>


-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