Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I get this error. the thing it should do is update the table in the database and my view order but i only get this error. How do i fix it any idea?
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
File name:edit1.php
My Codes
<?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 { ?>
My button 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>
–
–
When you call mysqli_error
you have to provide the connection object, according to the docs:
https://www.php.net/manual/en/mysqli.error.php
You are calling mysql_error like this: mysql_error()
which is incorrect.
I cannot see in your code where you create the mysql connection but lets pretend it is a variable named $conn
. You should change mysql_error()
to mysql_error($conn)
–
–
–