Working with a database I've created, I can run search queries that output data in JSON, then send them back to my webpage. Pretty standard.
$searchQuery = "SELECT * FROM alldata where $searchBy like '%$searchValue%'" ;
$searchResult = mysqli_query($con, $searchQuery);
while ($row = mysqli_fetch_row($searchResult)) {
$item = array();
$item["dateReceived"] = convertDate($row[1]);
$item["quoteCost"] = $row[15];
$item["quoteNumber"] = $row[16];
$item["quoteExpDate"] = convertDate($row[17]);
$item["comments"] = $row[21];
$output[] = $item;
}
$out = array('aaData' => $output);
echo json_encode($out);
When my query is too general, something fails, and I'm not sure where it is.
The response I get from the server is:
Fatal error : Allowed memory size of 134217728 bytes exhausted (tried to allocate 14680165 bytes) in C:\xampp\htdocs\....php</b> on line <b>74</b><br />
My memory limit is set in php.ini as:
memory_limit=128M
If I go into mySQL and write SELECT * FROM
alldataWHERE name like "%a%";
I get about 35,000 rows, each with about 20 columns, but it only takes a split second.
The amount that I can query against the table is prohibitively small - what can I do to fix this so my users can run more generic queries?