PHP & MySQL array problem

laserproduct

New Member
I'm trying to get the categories name from each array value from the database and then add the categories name to an array \[code\]$cat_name\[/code\], how can I do this using PHP & MySQL?\[code\]$array = array(1, 2, 3, 4, 5);$cat_name = array();$dbc = mysqli_query($mysqli,"SELECT category FROM categories WHERE id = '" . $array . "'"); if (!$dbc) { print mysqli_error($mysqli);} else { while($row = mysqli_fetch_array($dbc)){ $cat_name[] = $row['category']; }}\[/code\]
 
Back
Top