I have a quick newbie question.
When I'm posting things to a database I like to use a foreach statement to place the field name as the field value. It looks like this:
//GET THE VALUES
foreach($_POST as $varname=>$varvalue){
if (empty($varvalue)) {
$empty[$varname] = $varvalue;
} else {
$post[$varname] = $varvalue;
}
}
It works good so then all i have to do is right the name of variable and it will output that value.
My question is how would I do the same for a set of results that I receive from a mysql_query?
would it be something like this?
//GET THE VALUES
foreach(mysql_fetch_array as $key=>$value){
if (empty($value)) {
$empty[$key] = $value
} else {
mysql_fetch_array[$key] = $value;
}
}
Thanks for the help?