I need to two button on the script that I am using to show data from my database and then update a column in my database after the data has been shown.
One button to show the results instead of the results just showing when I navigate to the script, and the second button to update the printed column to the value of printed, so the script would not update the column if I were to accidentally refresh the page.
Below is the code I have, it works perfectly, but I would like to be able to utilize buttons to execute the query's, however, I am too much of a mewbie to figure it out. I've played around for hours and have tried several different solutions, just can't seem to get any to work properly.
The last code I finished, I fianlly had no errors, but the buttons didn't do anything..
Could someone please help??
<?php
$con = mysql_connect("localhost","autozen2_chris","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("autozen2_autozend", $con);
$result = mysql_query("SELECT *, probid_users.name AS name,
probid_winners.winner_id AS winnerid
FROM probid_winners
left join probid_users ON probid_users.user_id = probid_winners.buyer_id
WHERE probid_winners.payment_status='confirmed' AND printed='' AND buyer_id BETWEEN 2 AND 1000000000 ORDER BY bid_amount DESC");
echo "<table border='5'>
<tr>
<th>Name</th>
<th>Auction ID</th>
<th>Bid Amount</th>
<th>Deposit Status</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['auction_id'] . "</td>";
echo "<td>" . $row['bid_amount'] . "</td>";
echo "<td>" . $row['payment_status'] . "</td>";
echo "</tr>";
$res = mysql_query("UPDATE probid_winners SET printed='printed' WHERE probid_winners.winner_id = " . $row["winnerid"]);
}
echo "</table>";
mysql_close($con);
?>