Code:
$sqlresult = mysql_query($query);
while ( $pidnum = mysql_fetch_array($sqlresult) ) { //Take the results of the query and insert into an array
$updatecode = "UPDATE vote_stats SET lastvote=$now WHERE pid=$pidnum[pid]"; //Set query to update where pid is equal to the pid in the current offset of the array
$updatedb = mysql_query($updatecode, $s_dbid);
}
I added comments but basically what happens if when you run a mysql_query, it returns a resource ID aka tells the protocol where to look for the information that was returned. By calling mysql_fetch_array() on this result, you then take that information and put it into an array where the values are defined by the field name given in the mysql table. So now you have an array which contains the id your looking for, and you then take that array and go to the offset with the id and make it the check on your condition.
So what's going on is you get information from mysql, you put that information into something accessable, you find what you need and use it. If this doesn't make sense please try to elaborate on what doesn't make sense, or if it does feel free to ask something else. BTW if your query looking for the ID only returns ONE result (aka one ID, not the ID of more than one thing) you can always get rid of the while statement and do the same thing just get rid of while(){}, leave everything else in (IE leave the $pidnum = mysql_fetch_array($sqlresult); in)