PHP Classes not returning data PHP/MySQL -


im trying return record table following class...

class user {    public function getcredits($uid)    {        $rs = mysql_query("select bank `users` id = '$uid'");        $row=@mysql_fetch_object($rs);        return $row->bank;    } } 

i output data following...

    <?php print $user->getcredits(); ?> 

im not given however, though code cannot read , broweser display white page?

you have:

   $rs = mysql_query("select bank `users` id = '$uid'"); 

but call method ->getcredits(), $uid going null, , query ends being

 select bank users id = '' 

assuming id field standard integer/auto_increment, there no records have blank id, empty set. fetch_object return boolean false indicate fetch failure (no records fetch), , blindly try use boolean false data elsewhere.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -