IndianaJoe Posted September 25, 2017 Posted September 25, 2017 I can't for the life of me fine the way to return 1 result for a query. Right now I'm using \IPS\Db::i()->query("blah blah blah") Then a foreach, which will only run once. Is there a more efficient way of doing this?
Daniel F Posted September 25, 2017 Posted September 25, 2017 If you expect only 1 result (e.g. from where id = x or count(*) queries) you can use the first() method. \IPS\Db::i()->select( 'COUNT(*)', 'cms_database_categories' )->first();
IndianaJoe Posted September 25, 2017 Author Posted September 25, 2017 Thanks, I got it to work. I tried that previously, but was having issues with the array function.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.