I have a table that includes 53 rows, in my database. The variables in the rows are INT id, VARCHAR var, and INT votes. I can't figure out how to query all the rows within the table into an array. I want to be able to get the 'var' variable while referencing the id. Here is what I have so far, which indeed will only query the first row. (hence id = '1').
<?php
include_once "code.php";
$new_array = array();
$sql = mysql_query("SELECT * FROM Variables WHERE id='1'");
while ($row = mysql_fetch_array($sql)) {
$new_array[$row['id']] = $row;
};
I tried using a for loop and sticking a variable where the '1' is, but that's not working either. If you could please also show me how to get the var variable from referencing any of the ids that be great. Thanks