0

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

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by shamsidah
1

...

while($row = mysql_fetch_array($result)){
  $myarray[$row['defect_code']] = $row['total']; 
}
//check with:
print_r($myarray);
1

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

Edited by cereal: n/a

0

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

Thanks!! really appreciate

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.