I have the following quite simple test PHP that extracts the data and puts it into JSON formatted text.
I get the following error..
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1979603 bytes) in /var/www/test.php on line 33
Where line 33 is the json_encode() line.
Is there a way to make this more efficient? The PHP.ini is already set to 32M as max size up from the 8M standard!
<?php
require('../../admin/db_login.php');
$db=mysql_connect($host, $username, $password) or die('Could not connect');
mysql_select_db($db_name, $db) or die('');
$result = mysql_query("SELECT * from listinfo") or die('Could not query');
$json = array();
if(mysql_num_rows($result)){
$row=mysql_fetch_assoc($result);
while($row=mysql_fetch_row($result)){
// cast results to specific data types
$test_data[]=$row;
}
$json['testData']=$test_data;
}
mysql_close($db);
echo json_encode($json);
?>