Okay I tried this before and it got closed because it wasn't specific. Below is my entire page code. Please ignore the font and html stuff because all of that is working fine. My Specific question is how to alter this so that the column called "Given" is reset to 0 (zero) at the first day of each month automatically. I am only specifically asking for how to make this happen.
Everything else is working to manually add and subtract, etc. I only need assistance in making that column reset to zero on the first day of each month.
TO BE EVEN MORE SPECIFIC the column "OWED" in the database should be reset to 0 (zero) at the first day of each month automatically to achieve this.
I am new to coding and this code was made for me months ago, and while I have learned a lot since then, I do not seem to find any example to learn from on how to make what I am asking happen. Thank you
EDIT - The objective is to reset all of the rows in the "Owed" column at the same time. Either automatically each month, or manually with one button (or image button)
<?php
$servername = "localhost";
$username = " ";
$password = " ";
$db=" ";
$conn = mysqli_connect($servername, $username, $password,$db);
// $sql = "INSERT INTO `number`( `number`)
// VALUES ('$qty')";
$sql = "SELECT id,name,requests,owed FROM record ORDER BY name";
$result = $conn->query($sql);
?>
<!DOCTYPE html>
<html>
<head>
<style>
table#customers {
width: fit-content;
margin: auto;
margin-top: 2px;
}
#customers {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#customers td, #customers th {
border: 2px solid #B7B7B7;
padding: 4px;
}
#customers tr:nth-child(even){background-color: #ffffff;}
#customers tr:nth-child(odd){background-color: #f2f2f2;}
#customers tr:hover {background-color: aliceblue;}
#customers th {
padding-top: 2px;
padding-bottom: 2px;
text-align: center;
background-color: #FFB951;
color: black;
}
.sub-add{
float: right;
}
span.sub-add a {
text-decoration: none;
margin: 1px;
}
</style>
</head>
<body leftmargin="0" topmargin="0">
<meta http-equiv="refresh" content="10" >
<table id="customers" bgcolor="#CCCCCC">
<tr>
<th height="5" width="20%">Name</th>
<th height="5" width="20%" style="display:none">Requests</th>
<th height="5" width="10%">Earned</th>
<th height="5" width="10%">Given</th>
<th height="5" width="10%">Owed</th>
</tr>
<?php
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$earned = $row["requests"]/1;
$owed = $row["owed"];
$earned = (int)$earned;
$owedtoo = $earned - $owed;
echo '<tr><td><center><b><font color="Orange">'.$row["name"].'<font></b><br><a onclick="return confirm(\'Are You SURE You Want To Delete?\')" href="delete.php?id='.$row['id'].'">Delete</a> | <a href="updateentry.php?id='.$row['id'].'">Edit</a>
</center></td><center><td style="display:none"><center>'.$row["requests"].'<span class="sub-add"><a href="update.php?id='.$row["id"].'&method=minus&update=request"><span>-</span></a> <a href="updaterequests.php?id='.$row['id'].'"><span> +  </center></span></a></span></td></center><td><center><b><font color="green">'.$earned.'</font></b></td><center><td><center><b>'.$row["owed"].'</b><span class="sub-add"><a href="update.php?id='.$row["id"].'&method=minus&update=owed"><span> - </span></a> <a href="update.php?id='.$row["id"].'&method=add&update=owed"><span> + </span></a></span></center></td><td><center><b><font color="red">'.$owedtoo.'</font></b></td></tr>';
}
}
?>
</table>
</body>
</html>
<?php $conn->close(); ?>