| 
	
 | 
 Posted by ImOk on 06/17/38 11:53 
After you do the fetch run 
 
extract($row); 
 
This will cretae memory variables of the same name as the keys and 
containing the values. 
 
Study the example from docs: 
 
$size = "large"; 
$var_array = array("color" => "blue", 
                   "size"  => "medium", 
                   "shape" => "sphere"); 
extract($var_array, EXTR_PREFIX_SAME, "wddx"); 
 
echo "$color, $size, $shape, $wddx_size\n"; 
 
 
 
 
monomaniac21 wrote: 
> hi all 
> 
> is there a function to convert all values of array $row into seperate 
> variables: 
> 
> $row = mysql_fetch_array($result); 
> 
> // i dont want to have to do this anymore :-) 
> 
> $name = $row['name']; 
> $address1  = $row['address1']; 
> $address2 = $row['address2']; 
> etc etc etc 
>  
>  
>  
>  
> Regards 
>  
> marc
 
  
Navigation:
[Reply to this message] 
 |