CodeIgniter Forums
SQL execution timeout on single row - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: SQL execution timeout on single row (/showthread.php?tid=81849)



SQL execution timeout on single row - sjender - 05-10-2022

Hi,
I have a simple query.
PHP Code:
$serviceData $this->db->query("SELECT * FROM `services` WHERE `id` = ?", [$serviceId]);

return 
$serviceData->getResultArray() ?? []; 

This gives output, but since it's only 1 row (can never be more), I would like to use getRowArray() instead...
But that throws a maximum exection timeout on SQL...
Even when I use return $serviceData->getResultArray()[0] this execution timeout is thrown.

The collected data consists of 10 columns with very little data in it, so it can't possible be a heavy query....
I've tried the query builder as wel, same results.

I'm a little confused on where I should look for a solution for this issue....

never mind.....
It was an error somewhere further in the script calculating these results...


RE: SQL execution timeout on single row - superior - 05-12-2022

You could also add a 'LIMIT 1;' at the end of the query.


RE: SQL execution timeout on single row - InsiteFX - 05-12-2022

Did you try your query in phpAdmin to see if it is working correctly?