Is there an easier way to do this
| From: | Claymen | Date: | Mon, 08 Oct 2001 14:37:47 +0000 |
| Subject: | Is there an easier way to do this | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13110@lists.php.net to get a copy of this message | ||
Im writing a voting system for mp3s at lans
I wanna know if there is a simpler way to do the following
$songvotes = mysql_query("SELECT votes FROM mp3s Where ID=".$vote);
$row = mysql_fetch_array($songvotes);
$songvotes = $row["votes"];
mysql_query("UPDATE mp3s SET votes = ".($songvotes+1)." WHERE ID=".$vote);
}
what its doing is adding one to an mp3s votes when someone clicks a link ofr
submits a form to the script with the id of the song to give it a vote
where $vote is the id for the mp3 which is gotten via a query or posted from
a form
the mp3s table has 3 fields, the songname in text the id which is an
autoincremented integer and vote which is the number ov votes and is an
integer;
just the way i had to retreive the number of votes first is there a simpler
way to do that cause my way seems way to long and tedious
Claymen (claymen(at)cyberdude(dot)com)