I want an array to be declared like $value=array('apple'=>'red', 'mango'=>'yellow').
now i want this values to be fetched from the database.
both the apple and the red.
suppose this coloures are saved in table called 'colors' and fruits in the table 'fruits', with the color_id.
now how to fetch them and put inside this array.
i tried to put the codes in side the bracket like array(code to fetch) but it did'nt work. anybody can help?
table->fruit(fruit_id, color_id, fruit_name) table-> color(color_id, color_name)
$result=mysql_query("select * from
fruit_table");
while($row=mysql_fetch_array($result)){
$row_color-mysql_fetch_array(mysql_query("select color_name from colors where
color_id=$row['color_id']"));
$val[]="$row['fruit_name']=>$row_color[color_name]";
}
$data=implode(",",$val);
$value=array($data);
thanxx in advance.