I am wondering if there a function in php that can allow me put all my selected data in an array .Currently i am using mysql_fetch_array and as i have read in the manual,that function won't fetch every record in the table.
$result = mysql_query("SELECT * FROM $tableName");
$array = mysql_fetch_array($result);
echo json_encode($array);
mysql_...functions are old and unsafe. You should usedmysqlior better PDOs - php.net/manual/en/book.mysqli.php, php.net/manual/en/book.pdo.php$allRows = array(); while($row = mysql_fetch_array($result) {$allRows[] = $row }mysql_*functions in new code. They were removed from PHP 7.0.0 in 2015. Instead, use prepared statements via PDO or MySQLi. See Why shouldn't I use mysql_* functions in PHP? for more information.)for his while.$allRows = array(); while($row = mysql_fetch_array($result)) {$allRows[] = $row }