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
Post a Comment