sup
So basically, I'm doing e-commerce site for a habshit retro and I need to get approving works. When you click the tick icon, it should update table like "UPDATE purchase_logs SET approver = "Shop Staff" WHERE id = '".$row['id'] ."'" .. But it does nothing.
My code below:
So basically, I'm doing e-commerce site for a habshit retro and I need to get approving works. When you click the tick icon, it should update table like "UPDATE purchase_logs SET approver = "Shop Staff" WHERE id = '".$row['id'] ."'" .. But it does nothing.
My code below:
PHP:
<?php
$query = "SELECT * FROM purchase_logs WHERE approver = ''";
$result = mysql_query($query);
echo mysql_error();
echo "<table class='table table-hover'> <thead>
<tr>
<th>#</th>
<th>Username</th>
<th>Approver</th>
<th> Approve </th>
</tr>
</thead><tbody>"; // start a table tag in the HTML
while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results
$username = $row['username'];
echo "<tr><td>" . $row['id'] . "</td><td>" . $row['username'] . "</td><td>Still needs approve!</td><td><a href='?username=" . $row['username'] . " '>Approve</a></td> </tr></tdbody>"; //$row['index'] the index here is a field name
}if($row <= 0) {
echo "</tbody><tr><td> No more results!</td><td></td><td></td><td></td></tr>";}
$sql = "UPDATE `purchase_logs` SET `approver`='Shop Staff' WHERE (`id`='".$row['id']."')";
echo "</table>"; //Close the table in HTML
echo $id;
echo $row['id'];
if($_GET['username=$username']) {
mysql_query($sql); }
?>
Last edited: