setting variables in a foreach loop
Posted: Sun Jun 27, 2004 11:56 am
Hey, is there any special syntax I must use if I am going to define variables in a foreach loop? For example, would something like this work?
Any help would be appreciated.
Thanks.
Code: Select all
<?php
foreach ($array as $key => $value) {
$mysql_query = "select $key from users where userid = $value";
mysql_query ($mysql_query);
}
?>Thanks.