Warning: mysqli_query() expects at least 2 parameters

<?php
$conn = mysql_connect('localhost','root','') or die("MYSQL_connect:".mysql_errno());
mysqli_query("set name gbk");
?>

请问哪里错了 请指正 谢谢大神 ~
最新回答
欲往

2024-11-07 17:55:20

mysqli_query($conn,"set name gbk");//少了个参数
傲慢多泪

2024-11-07 10:56:59

  1. 少了必须参数

    mysqli_query(connection,query,resultmode);

  2. // 假定数据库用户名:root,密码:123456,数据库:RUNOOB $con=mysqli_connect("localhost","root","123456","RUNOOB"); 
    if (mysqli_connect_errno($con)) { 
        echo "连接 MySQL 失败: " . mysqli_connect_error(); 

     // 执行查询mysqli_query($con,"SELECT * FROM websites");mysqli_query($con,"INSERT INTO websites (name, url, alexa, country)
    VALUES ('百度','https://www.baidu.com/','4','CN')"); 
    mysqli_close($con);