CodeIgniter Forums
how can I create an empty database query object? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: how can I create an empty database query object? (/showthread.php?tid=17566)

Pages: 1 2


how can I create an empty database query object? - El Forum - 04-09-2009

[eluser]NogDog[/eluser]
Something that I just thought of: there's actually no need to query a table:
Code:
SELECT 1 WHERE 1=2



how can I create an empty database query object? - El Forum - 08-20-2012

[eluser]Reevak[/eluser]
Since nobody answered your question properly, this is how you create an empty DB object in CI 2.1

$query = new CI_DB_mysql_result();

Then if you run $result = $query->result_array(); it won't break Smile


how can I create an empty database query object? - El Forum - 08-20-2012

[eluser]Reevak[/eluser]
Create an empty DB object like this:

Code:
$query = new CI_DB_mysql_result();

And it won't break if you run this:

Code:
$query_thread = $query->result_array();