I have a select and is limited at 525 results otherwise the while will stuck.
$query_other = "SELECT * FROM prod where active=1 and aprobat=1";
$other = mysql_query($query_other, $conn) or die(mysql_error());
while($row = mysql_fetch_assoc($other)){
$other_prod[]=$row;
}
In cpanel it shows more than 525 and when i did var_dump on $other its says resource(525) of type (mysql result). Its on Apache Server if that helps.
If i put LIMIT 525 it works and show all page otherwise is just blank page. Anything after the while doesn't work.
P.S : I know mysql_ is deprecated i hate it but is required at the task and i have no power over it.
Increasing memory won't help. It's just a temporary fix. Plus you need to think of multiple clients doing the same query at the same time. How's the system going to keep up with the memory consumption.
BUT be selective about the fields you need to pull back.
Don't:
SELECT *
Do:
SELECT `field1`, `field2`, ...
This will decrease memory consumption and let you deal with things. I imagine you don't need all the rows. And you especially want to avoid TEXT
/BLOB
ones as they are usually large. Select them only when you need to display/use them.
You can also use:
LIMIT 0, 100
to paginate through the results. Might help you a bit but I'd select the right fields to fix this permanently.
Also set:
ini_set('display_errors', true);
error_reporting(-1);
and see if PHP tells you more about what goes wrong.
if the problem is indeed memory, you can increase it dynamically with this:
ini_set("memory_limit","512M"); //i.e. change the memory_limit to 512M, you should specify more than current limit.