mysqli_query出错

时间:2017-09-12 05:44:02

标签: mysqli

我有以下代码:

$sql_query = "insert into table students('aarthi','abinesh','anand','aprna','babyshalini','bharathi','dinesh','dhivya','gayathri','gnanaprakash','gokila','gowthem','ibrahim','inbavalli','joemoantom','karthikeyan','kavya','kiruthika','madhumitha','mouliya','nandhini','nithya','prasanth','praveenkumar','priyanga','rajashri','rajkumar','rangashree','reshma','rohan','roja','sangavi','sinthuja','sivasanker_m','sivasanker_v','sowdeshwaran','sowmiya','subash','tamilvalavan','vaishnavi','vasanthakumar','aarchana','dhayalakumaran_sabeesan','premkumar') values ('$m1','$m2','$m3','$m4','$m5','$m6','$m7','$m8','$m9','$m10','$m11','$m12','$m13','$m14','$m15','$m16','$m17','$m18','$m19','$m20','$m21','$m22','$m23','$m24','$m25','$m26','$m27','$m28','$m29','$m30','$m31','$m32','$m33','$m34','$m35','$m36','$m37','$m38','$m39','$m40','$m41','$m42','$m43','$m44')";
mysqli_query($db_select,$sql_query);

它显示以下错误:

  

警告:mysqli_query()期望参数1为mysqli,boolean   在C:\ Program Files \ EasyPHP-Devserver-17 \ eds-www \ mark \ upload.php中给出   第51行

1 个答案:

答案 0 :(得分:1)

问题来自$db_select您应该发布它,看看您可以看到mysqli doc了解更多信息:http://php.net/manual/en/mysqli.query.php

请查看以下示例中的$link

<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

/* Create table doesn't return a resultset */
if (mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
    printf("Table myCity successfully created.\n");
}