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

( ! ) Warning: mysqli_query() expects at least 2 parameters, 1 given in D:\Zend\mall\register.php on line 50



Call Stack



#TimeMemoryFunctionLocation
10.0006253408{main}( )..\register.php:0
20.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 51



Call Stack



#TimeMemoryFunctionLocation
10.0006253408{main}( )..\register.php:0
20.0045263440mysqli_fetch_assoc ( )..\register.php:51

<?php

if (!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;
      


我是无极限
浏览 882回答 2
2回答

宣言的言

不只是函数名要mysqli ,参数和顺序也有些不同,报错是参数缺失
打开App,查看更多内容
随时随地看视频慕课网APP