Uncaught ArgumentCountError: mysqli_error() expects exactly 1 argument, 0 given

Uncaught ArgumentCountError: mysqli_error() expects exactly 1 argument, 0 given

我收到这个错误。它应该做的是更新数据库中的 table 和我的视图顺序,但我只收到此错误。我该如何解决它?

Fatal error: Uncaught ArgumentCountError: mysqli_error() expects exactly 1 argument, 0 given in C:\xampp\htdocs\final\Admin\edit1.php:108
Stack trace:
#0 C:\xampp\htdocs\final\Admin\edit1.php(108): mysqli_error()
#1 {main} thrown in C:\xampp\htdocs\final\Admin\edit1.php on line 108

文件name:edit1.php

我的代码

<?php $status = ""; if(isset($_POST['new']) && $_POST['new']==1) { $id=$_REQUEST['id']; $name =$_REQUEST['name']; $email =$_REQUEST['email']; $phone=$_REQUEST['phone']; $address=$_REQUEST['address']; $mode=$_REQUEST['pmode']; $products=$_REQUEST['products']; $amount_paid=$_REQUEST['amount_paid']; $Status=$_REQUEST['Status']; $update="update orders set name='".$name."', email='".$email."', phone='".$phone."', address='".$address.",'pmode='".$mode."', products='".$products."', amount_paid='".$amount_paid."', Status='".$Status."' where id='".$id."'"; mysqli_query($con, $update) or die(mysqli_error()); $status = "Record Updated Successfully. </br></br><a href='view1.php'>View Updated Record</a>"; echo '<p style="color:#FF0000;">'.$status.'</p>'; }else { ?>

我的按钮Codes/placeholder

<form name="form" method="post" action="">  <input type="hidden" name="new" value="1" /> <input name="id" type="hidden" value="<?php echo $row['id'];?>" /> <p><input type="text" name="name" placeholder="Enter Name" required value="<?php echo $row['name'];?>" /></p> <p><input type="text" name="email" placeholder="Enter Email" required value="<?php echo $row['email'];?>" /></p> <p><input type="text" name="phone" placeholder="Enter Phone" required value="<?php echo $row['phone'];?>" /></p> <p><input type="text" name="address" placeholder="Enter Address" required value="<?php echo $row['address'];?>" /></p> <p><input type="text" name="pmode" placeholder="Enter Payment Mode" required value="<?php echo $row['pmode'];?>" /></p> <p><input type="text" name="products" placeholder="Enter products" required value="<?php echo $row['products'];?>" /></p> <p><input type="text" name="amount_paid" placeholder="Enter Amount Paid" required value="<?php echo $row['amount_paid'];?>" /></p> <p><select name="Status" required value="<?php echo $row['Status'];?>" class="form-control">
          <option value="" selected disabled>-Select Status-</option>
          <option value="Incomplete">Incomplete</option>
          <option value="Complete">Complete</option>
        </select> </p> <p><input name="submit" type="submit" value="Update" /></p> 

当您调用 mysqli_error 时,您必须提供连接对象,根据文档:

https://www.php.net/manual/en/mysqli.error.php

您这样调用 mysql_error:mysql_error() 这是不正确的。

我在你的代码中看不到你创建 mysql 连接的地方,但我们假设它是一个名为 $conn 的变量。您应该将 mysql_error() 更改为 mysql_error($conn)