Table's name: grandTotal
(have two fields :defect_code and total)
defect_code total
LM 23
FM 15
DF 5
How this data can be an array like this
array("LM" >=23, "FM">=15,"DF">=5) using query? please help me..:S
Table's name: grandTotal
(have two fields :defect_code and total)
defect_code total
LM 23
FM 15
DF 5
How this data can be an array like this
array("LM" >=23, "FM">=15,"DF">=5) using query? please help me..:S
...
while($row = mysql_fetch_array($result)){
$myarray[$row['defect_code']] = $row['total'];
}
//check with:
print_r($myarray);
This should work:
<?php
# ...
# connection code
# ...
$q = mysql_query('select defect_code, total from grandTotal');
$a = array();
while($row = mysql_fetch_object($q))
{
$a[$row->defect_code] = $row->total;
}
print_r($a); # display array
?>
bye :)
ooops ardav, I just saw your reply, sorry.. :D
Aha, cereal you OOPed it. Nice. :)
Table's name: grandTotal
(have two fields :defect_code and total)defect_code total
LM 23
FM 15
DF 5How this data can be an array like this
array("LM" >=23, "FM">=15,"DF">=5) using query? please help me..:S
Thanks!! really appreciate
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.