I was wanting to make an associative array that would have all the fields together.
$query = 'SELECT id, name FROM categories';
if ($result = $mysqli->query($query))
{
while ($row = $result->fetch_assoc())
{
$categories = array($row['id'] => $row['name']);
}
}
print_r($categories);//this prints out all my categories as an associative array
//example 1=> 'cars', 30=>'trucks', 120=>'vans'