php - invalid MySQL argument in mysql_fetch_array -
warning: mysql_fetch_array(): supplied argument not valid mysql result resource in /rideanddrive/_classes/__base.php on line 45
my code :
public static function selectspecific($obj, $data_base, $cond) { self::$query = "select $obj " . self::$baseprefix . "$data_base $cond"; $out = self::execute(); $array = mysql_fetch_array($out); // line warning line return $array[$obj]; }
execute function, if needed :
private static function execute() { $out = mysql_query(self::$query); return $out; }
code's works fine. don't warning on localhost (running wamp, might have turned them off ?), works on live server, i'm getting above warning, how correct warning gone ?
on selectspecific function embed if
check see execute function returning proper resource result .. if not echo sql run on server separately if can find error if there error sql ,here updated function if
embedded
public static function selectspecific($obj, $data_base, $cond) { self::$query = "select $obj " . self::$baseprefix . "$data_base $cond"; $out = self::execute(); if($out){ $array = mysql_fetch_array($out); // line warning line return $array[$obj]; }else { return false; } }
Comments
Post a Comment