Reputation: 171
Hello I am facing problem with memory limit.
Please find the code below and let me guide if any thing mistake in my code.
function getRecords($table, $limit = '') {
global $db;
if (isNotEmpty($limit)) {
$intLimit = intval($limit);
$sql = "SELECT * FROM $table limit $intLimit";
} else {
$sql = "SELECT * FROM $table";
}
$sth = $db->query($sql);
return $sth->fetchAll();
}
Thank you.
Upvotes: 1
Views: 668
Reputation: 171
With the help of Mayank I have solved this issue. I have just set the limit in this code.
Thanks All
Upvotes: 0
Reputation: 26258
If your query is taking so much time then you have to work on it. Always use some optimization techniques in this case:
SELECT *
, until all column are requiredUpvotes: 1