update entire table with pdo
- by MephDaddy
I am working on a simple gaming ladder script. I am having little to no luck trying to find an effective way to reset my ladder information while leaving my table id and name fields intact.
I am trying to get create a loop to update my entire table, similar to the way I draw my table. Shown below.
......
//Start displaying ladder with with team with most wins at the top
echo "<TABLE border=1 width=500 align=center><TR>";
foreach($db->query('SELECT * FROM test ORDER BY win DESC , name ASC') as $row) {
echo "<TR><TD>" . $row['name'] . "</TD><TD>" . $row['win'] . "</TD><TD>";
echo $row['loss'] . "</TD><TD>" . $row['battles'] . "</TD><TD>";
echo $row['score'] . "</TD></TR>";
}
......
I currently have a table with 6 fields(id,name,win,loss,battles,score). I want to reset the values of win,loss,battles, and score back to 0. While leaving id and name alone. Effective reseting my ladder for a new season to begin.
The only way I have been able to complete this is to find out how many rows there are and run a for loop. It seems vary inefficient. Was hoping I could get some better insight as to how to go about this.