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

$flds = implode(",", $info_request);
$sql = "INSERT INTO mytable($flds)"

mysql_query($sql)

hope it helps at least a little.

-elias
http://www.kameelah.org/eassoft

"midget2000x" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> another newbie programmer question...
> is it possible to output the results of an array loop into a variable, or
> directly into an SQL call?
>
> 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)
> ...
>
> thanks!
> -----------
> providing the finest in midget technology
>
> --
> 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]
>



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