Hello all i am a newbie and i would love to learn from you all. Please help me as i am making a project with phpmysqli where i need to approve a pending status! Here's my code. Kindly help me thanks.

<?php
 ////////////////////////////////////////////
// Collecting data from query string
$id=$_GET['id'];
// Checking data it is a number or not
if(!is_numeric($id)){
echo "Data Error";
exit;
}
// MySQL connection string
require "dbconfig.php"; 

$count="SELECT * FROM createnearmiss where id=?";

if($stmt = $connection->prepare($count)){
  $stmt->bind_param('i',$id);
  $stmt->execute();

 $result = $stmt->get_result();

 $row=$result->fetch_object();
 echo "<table>";
echo "

   <table> <tr> <th>Details :</th> <td>$row->details</td> </tr> <tr> <th>Location :</th> <td>$row->location</td> </tr> <tr> <th>Date :</th> <td>$row->date</td> </tr> <tr> <th>Time :</th> <td>$row->time</td> </tr> <tr> <th>Checkbox :</th> <td>$row->checkbox</td> </tr> <tr> <th>Name :</th> <td>$row->name</td> </tr> <tr> <th>Employeeid :</th> <td>$row->employeeid</td> </tr> <tr> <th>Age :</th> <td>$row->age</td> </tr> <tr> <th>Department :</th> <td>$row->department</td> </tr> <tr> <th>Contact :</th> <td>$row->contact</td> </tr> <tr> <th>Organization :</th> <td>$row->organization</td> </tr> <tr> <th>Summary :</th> <td>$row->summary</td> </tr> <tr> <th>Images :</th> <td>$row->images</td> </tr> <tr> <th>Outcome :</th> <td>$row->outcome</td> </tr> <tr> <th>Cause :</th> <td>$row->cause</td> </tr> <tr> <th>Action :</th> <td>$row->action</td> </tr> <tr> <th>Reportedby :</th> <td>$row->reportedbyname</td> </tr> <tr> <th>Position :</th> <td>$row->position</td> </tr> <tr> <th>Organisation :</th> <td>$row->reportedorganisation</td> </tr> <tr> <th>Reportedcontact :</th> <td>$row->reportedcontact</td> </tr> <tr> <th>Status :</th> <td>$row->status</td> </tr> </table>

";

echo "</table>";
}else{
echo $connection->error;
}
?> <form action='' method='post'> <input type='submit' value='Approved' name='status1'> <input type='submit' value='Rejected' name='status2'> </form> <?php
include 'dbconfig.php';

if(isset($_POST['submit']))
{
    mysqli_query($link,"update createnearmiss set status='$_POST[status1]'");
}
?>

Why are you mixing the OOP variant of mysqli on lines 15-21 with the procedural variant on line 38 ??

commented: i get it now but if you have time can you please show me oop version for updating the coloumn? variant +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.