问题描述:
mysql_fetch_array与mysql_fetch_row用法的区别是什么?mysql_fetch_array与mysql_fetch_row用法的区别是
我写了个sql类查询语句,一下是片段语句:
/**
* 查询方法
*
* @param $table 表名
* @param $where 查询条件
* @param $fields 查询字段 默认为*
* @param $type false返回单条记录,ture返回多条记录,默认为false
*
* @return $result 查询结果集,数组
* $tr gfhjgj
*/
function select($table,$where=1,$fields="*",$type=FALSE){
$sql="select $fields from $table where $where";
$query=$this->query($sql);
if($type==FALSE){
while($rs=$this->mysql_fetch_array($query)){
$result[]=$rs;
}
}else{
while($rs=$this->mysql_fetch_row($query)){
$result[]=$rs;
}
}
return $result;
}
我就是想问下 上面写的查单条用mysql_fetch_array多条用mysql_fetch_row有点没搞懂,请大侠们指导下····
我写了个sql类查询语句,一下是片段语句:
/**
* 查询方法
*
* @param $table 表名
* @param $where 查询条件
* @param $fields 查询字段 默认为*
* @param $type false返回单条记录,ture返回多条记录,默认为false
*
* @return $result 查询结果集,数组
* $tr gfhjgj
*/
function select($table,$where=1,$fields="*",$type=FALSE){
$sql="select $fields from $table where $where";
$query=$this->query($sql);
if($type==FALSE){
while($rs=$this->mysql_fetch_array($query)){
$result[]=$rs;
}
}else{
while($rs=$this->mysql_fetch_row($query)){
$result[]=$rs;
}
}
return $result;
}
我就是想问下 上面写的查单条用mysql_fetch_array多条用mysql_fetch_row有点没搞懂,请大侠们指导下····
问题解答:
我来补答展开全文阅读