Database Query result frustration - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Database Query result frustration (/showthread.php?tid=76068) |
Database Query result frustration - stlake2011 - 04-12-2020 Hi all, Am having a hell of a time trying to figure out whats going wrong here or what maybe i am missing. Been troubleshooting this error for far to many hours now. I am writing a custom login library, but when I query the database for a username/email address, the query is not returning any results at all. I ran the same query itself in phpmyadmin and it is finding the result expected there. So I figure I will put it here and maybe you people might see something my blurring eyes are missing. Below is the relevant piece code: PHP Code: $sql = "SELECT user_id,user_group,username,passwd FROM users WHERE username=?"; EDIT Found the error! It was in the IF statement itself. It was all syntax errors with the count function that somehow were not being thrown. Not sure if thats a PHP Issue but perhaps the developers could write a wrapper around count for the databases that would simplify it further? Also one thing that puzzles me though is why is_array() is returning false on the result array when its clearly true? RE: Database Query result frustration - vincent78 - 04-12-2020 (04-12-2020, 08:48 AM)stlake2011 Wrote: Also one thing that puzzles me though is why is_array() is returning false on the result array when its clearly true? Hello, Just put: PHP Code: var_dump($db_result); Vincent |