Thread: SQL Query??
View Single Post
Old 11-21-2007, 06:34 PM   #9 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Okey, I got another problem regarding SQL queries.
I couldn't be bothered creating a new topic just for that when I already have this one..

Quote:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\DB Class 2\includes\classes\user.php on line 126
user.php
php Code:
public function user_is_logged_in() {
           
            $sql = sprintf("    SELECT
                                    `%s`
                                FROM
                                    `%s`
                                WHERE
                                    `%s` = '%s'
                                LIMIT 1"
,
                               
                                $this->db->col['user_id'],
                                $this->db->table['users'],
                                $this->db->col['user_session'],
                                session_id());
                               
            $query = $this->db->query($sql);
           
            if(!mysql_num_rows($query)) {
               
                return false;
               
            }
           
            return true;
           
        }
Tanax is offline  
Reply With Quote