RE: [PHP-DB] Is there an easier way to do this
| From: | Boget, Chris | Date: | Mon, 08 Oct 2001 14:49:38 +0000 |
| Subject: | RE: [PHP-DB] Is there an easier way to do this | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13111@lists.php.net to get a copy of this message | ||
> $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);
> }
I believe this will do it:
$query = "UPDATE mp3s set votes = ( votes + 1 ) where id = $vote";
Chris