I have this code below and I am trying to get results from query as array containing array key to be table field name and value to be the result from the field. So far I have this:
$query='select
en_product_name,de_product_name,fr_product_name,ru_product_name
from products where id="'.$pid.'"';
$result=mysql_query($query) or die('Mysql Error:'.mysql_error().'<br /> Query:'.$query);
$num_rows=mysql_num_rows($result);
$row = mysql_fetch_array($result);
$columns = mysql_num_fields($result);
$fields =array();
for($i = 0; $i < $columns; $i++) {
echo $fields = mysql_field_name($result,$i).'<br />';
}
this $fields returnes only the field name.. How can I have the result as: Array ( [en_product_name] => New en product name, [de_product_name] => New de product name) and etc.. Thank you for any help and suggestions
$fields[key] = $value;
– krishna Feb 12 at 10:26