Hi
I would like to be able to use a foreach loop to make variables directly from the result row like this
$_SESSION['client'] = array();
$sql = "SELECT * FROM client WHERE ID_Client_SITE='".$id."'";
$res = mysql_query($sql)or die(mysql_error());
if (!$res) {
$_SESSION['client']["error"] = "not found";
}else{
$_SESSION['client']["error"] = "";
$row = mysql_fetch_row($res){
foreach ($row as $k => stripslashes($v)) {
$_SESSION['client'][$k] => $v;
}
}
//
//
the problem is that i'm getting parse error from the line
$row = mysql_fetch_row($res){
but i just can't see why
also, i want to use the db table column name as the key name in the session variable (eg the $row['id'] will give $_SESSION['client']["id"] ) but i have a feeling that using mysql_fetch_row() is not going to let me do that because it seems that it just returns an arrray without key names
so what would be the best way overall to go about what i'm trying to do ?
thanks