日期:2014-05-17 浏览次数:20427 次
public function querySql($sql){ $data_array = parse_ini_file("database.ini",true); $connect = @mysql_connect($data_array["url"],$data_array["username"],$data_array["pass"]) or die ("Unable to connect database server!"); mysql_query("set names '".$data_array["incode"]."'"); $query = mysql_db_query($data_array["basename"],$sql ,$connect); $arrary; if(!$query){ echo "数据库连接错误"; }else{ $arrary = mysql_fetch_array($query); } $close = @mysql_close($connect) or die ("Unable to close database server connect!"); return $arrary; }
...... }else{ while($r = mysql_fetch_array($query)) $arrary[] = $r; } ....
------解决方案--------------------
else{
while($arrary = mysql_fetch_array($query,MYSQL_ASSOC)){
var_dump($arrary);
}
}
------解决方案--------------------
else{ $arry = array(); while($arr = @mysql_fetch_array($result,MYSQL_ASSOC)){ array_push($arry,$arr); } return $arry; }