为了账号安全,请及时绑定邮箱和手机立即绑定

原生商城数据链接问题。原来说要用mysqli,换了也不行啊

原生商城数据链接问题。原来说要用mysqli,换了也不行啊

PHP
我是无极限 2018-09-04 18:21:06
( ! ) Warning: mysqli_query() expects at least 2 parameters, 1 given in D:\Zend\mall\register.php on line 50Call Stack#TimeMemoryFunctionLocation10.0006253408{main}( )..\register.php:020.0024262832mysqli_query ( )..\register.php:50( ! ) Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in D:\Zend\mall\register.php on line 51Call Stack#TimeMemoryFunctionLocation10.0006253408{main}( )..\register.php:020.0045263440mysqli_fetch_assoc ( )..\register.php:51<?phpif (!empty($_POST['username'])){//     include_once './lib/fun.php';        $username=trim($_POST['username']);    $password=trim($_POST['password']);    $repassword=trim($_POST['repassword']);    if(!$username)    {        echo '用户名不能为空';        exit;    }        if(!$password)    {        echo '密码不能为空';        exit;    }        if(!$repassword)    {        echo '确认密码不能为空';        exit;    }        if($password!==$repassword)    {        echo '两次输入密码不一致,请重新输入';        exit;            }            $con= mysqli_connect('127.0.0.1','root','123456','imooc_mall');    if(!$con)    {        echo mysql_error();        exit;    }};        //判断用户是否在数据表存在    $sql="SELECT COUNT('id')   FROM `im_user`   WHERE 'username'='{$username}'";        $obj=mysqli_query($sql);    $result=mysqli_fetch_assoc($obj);    var_dump($result);die;      
查看完整描述

2 回答

?
宣言的言

TA贡献3条经验 获得超1个赞

不只是函数名要mysqli ,参数和顺序也有些不同,报错是参数缺失

查看完整回答
反对 回复 2018-10-04
  • 2 回答
  • 0 关注
  • 876 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信