I am able to display rows of data in a table. and i wanted to put a button at the end of each table so that i would be able to delete/edit that specific row. so here it is
$found_row = 0;
$result = mysqli_query($conn,"SELECT * from TICKET INNER JOIN CUSTOMER ON TICKET.CUSTOMER_ID=CUSTOMER.CUSTOMER_ID");
echo "<table>"; // start a table tag in the HTML
echo "<tr>
<th>Ticket ID</th>
<th>Customer ID</th>
<th>Name</th>
<th>Address</th>
<th>Phone</th>
<th>Email</th>
<th>Pickup Date</th>
<th>Pickup Time</th>
<th>Delivery Date</th>
<th>Delivery Time</th>
<th>Payment Mode</th>
<th>Payment Status</th>
<th>Ticket Status</th>
<th>EDIT STATUS</th>
</tr>";
while($row = mysqli_fetch_array($result)){ //Creates a loop to loop through results
$found_row = true;
$wow = $row['TICKET_ID'];
echo " <tr>
<td>".$row['TICKET_ID']."</td>
<td>".$row['CUSTOMER_ID']."</td>
<td>".$row['CUSTOMER_NAME']."</td>
<td>".$row['CUSTOMER_ADDRESS']."</td>
<td>".$row['CUSTOMER_PHONE']."</td>
<td>".$row['CUSTOMER_EMAIL']."</td>
<td>".$row['TICKET_PICKUP']."</td>
<td>".$row['TICKET_PTIME']."</td>
<td>".$row['TICKET_DELIVERY']."</td>
<td>".$row['TICKET_DTIME']."</td>
<td>".$row['TICKET_PAYMENT']."</td>
<td>".$row['PAYMENT_STATUS']."</td>
<td>".$row['TICKET_STATUS']."</td>
<td>".("<a href='cancelticket1.php?id=$wow'>Delete</a>")."</td></tr>";
}
if ($found_row == false) {
echo "No Ticket Submitted";
}
echo "</table>";
so for now i am able to redirect the page with return value of the ticket_id for each row.. the url being /cancelticket1.php?id=1001 for example. and in the page cancelticket1.php, here are the code:
$cancelticket=$_GET['$wow'];
$sql = "DELETE FROM TICKET WHERE TICKET_ID=$cancelticket";
if ($conn->query($sql) === TRUE) {
echo "Ticket Has Been Deleted";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
from here I am stumped on how to retrieve that ticket_id, and i keep getting error message however i tried. please help me.