I'm trying to update my tables with a total number of uses when a function is called. What I need to do is grab the former number of uses, and add one. I have a pretty good general idea how to go about this, but I don't quite know how to get unique ID's with their respective uses. This is what I have so far...
<?php
$query = $conn->query('select name, uses from users');
$i = 0;
while($r = $query->fetch(PDO::FETCH_OBJ)){
$name[$i] = $r->name;
$uses[$i] = $r->uses;
$i = $i+1;
}
if(isset($_POST['mName']))
{
$mName = urldecode($_POST['mName']);
$mUses = $uses + 1;
"UPDATE users
SET uses=:uses WHERE name=:name";
$stmt = $conn->prepare($sqlUPDATE);
$stmt->bindParam(':uses', $mUses);
$stmt->bindParam(':name', $mName);
$stmt->execute();
?>
I can see my issue is that I'm assigning the uses variable to an array, I don't know how to get it specific to the username. Is this a simple SQL query I'm missing?