php - Foreach returned $variable[] select from database and combine values -
i have tried around couple of ways , different manners no luck. (also searched different solutions) sure i'm missing something.
i have following code:
$variable = returned array eg. 7, 8, 9; foreach($variable $entry_id){ $query = mysql_query("select * table entry_id=$entry_id") or die (mysql_error()); while($row = mysql_fethc_array($query)){ $qty = $row['quantity']; $combination = array_combine($qty); } }
everything works , correct quantities returned (on testing) combinations not correct. combinations - of each entry_id - combined next one.
instead of receiveing eg.
$entry_id(7) = 15; $entry_id(8) = 26; $entry_id(9) = 58;
i getting:
$entry_id(7) = 15; $entry_id(8) = 41; $entry_id(9) = 99;
the table structure this:
entry_id | quantity 7 | 5 7 | 5 9 | 29 8 | 26 7 | 5 9 | 29
Comments
Post a Comment