原文链接:http://www.zhixing123.cn/php/32916.html

//从结果集中获取所有的数据
function getAll($sql) {
    $query=mysql_query($sql);
    if($query) {
        $temp=array();
        while($res=mysql_fetch_assoc($query)) {
            $temp[]=$res;
        }
        return $temp;//定义一个空数组用于存储接收到的数据
    }
    else{
    return false;
    }
}
    
    
//获取一条数据
function getOne($sql) {
    $query=mysql_query($sql);
    if($query) {
        $res=mysql_fetch_assoc($query);
        return $res;
    }
    else{
        return false;
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2023-03-20
  • 2017-11-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
相关资源
相似解决方案