警告:mysqli_error()只需要1个参数,给定0 [英] Warning: mysqli_error() expects exactly 1 parameter, 0 given
本文介绍了警告:mysqli_error()只需要1个参数,给定0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我查看下面的代码
<?php
include( includes / dbconnet.php);
$ name = $ _ POST [' name'];
$ email = $ _ POST [' email'];
$ telephone = $ _ POST [' telephone'];
$ subject = $ _ POST [' subject'];
$ mesg = $ _ POST [' mesg'];
$ sql = INSERT INTO APPL SET name ='$ name',
email =' $ email',
电话='$电话',
subject ='$ subject',
mesg ='$ mesg';
$ result = mysqli_query($ conn,$ sql)或 die(mysqli_error());
if($ result == true)
{
header(' location: ?的index.php成功跨度>);
}
else
{
echo 错误;
}
?>
<? php
$ conn = mysqli_connect(' localhost',' root',' ')或 die(mysqli_error());
/ * 选择数据库* /
$ select_db = mysqli_select_db($ conn,' practice')或 die(mysqli_error());
?>
我得到的错误警告:mysqli_error()预计只有1个参数,
我尝试了什么:
我试图对其进行故障排除并查看我的数据库连接,但我无法得到它
请帮助解决错误
解决方案
name =
_POST [' name'];
电子邮件=
Please kindly help me to look into the code bellow
<?php
include("includes/dbconnet.php");
$name=$_POST['name'];
$email=$_POST['email'];
$telephone=$_POST['telephone'];
$subject=$_POST['subject'];
$mesg=$_POST['mesg'];
$sql="INSERT INTO pract SET name='$name',
email='$email',
telephone='$telephone',
subject='$subject',
mesg='$mesg'";
$result=mysqli_query($conn,$sql) or die (mysqli_error());
if($result==true)
{
header('location:index.php?success');
}
else
{
echo "Error";
}
?>
<?php
$conn = mysqli_connect('localhost','root','') or die(mysqli_error());
/*Select Database*/
$select_db = mysqli_select_db($conn,'practise') or die(mysqli_error());
?>
The error I get "Warning: mysqli_error() expects exactly 1 parameter,
What I have tried:
I tried to troubleshoot it and look into my database connection but I couldn't get it
Please kindly help to resolved the error
解决方案
name=
_POST['name'];
email=
这篇关于警告:mysqli_error()只需要1个参数,给定0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文