Forums

PHP

This topic is locked

PHP UPDATE problem

Posted 09 Mar 2003 08:53:48
1
has voted
09 Mar 2003 08:53:48 Terry Lau posted:
Hello,
I am creating a polling system using php_mysql. Its operation likes this:
when the people vote the item, it updates the database by adding 1 for the item automatically.
But MySQL doesn't include the stored procedure, so I write a PHP code by myself.
The part of code is showed here:

<?php
$colname_rsAddVote = "1";
if (isset($HTTP_POST_VARS['Vote'])) {
$colname_rsAddVote = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['Vote'] : addslashes($HTTP_POST_VARS['Vote']);
}
mysql_select_db($database_cnTesting, $cnTesting);
$query_rsAddVote = "UPDATE Testing SET GetVotes = GetVotes + 1 WHERE VoteID = %s", $colname_rsAddVote);
$rsAddVote = mysql_query($query_rsAddVote, $cnTesting) or die(mysql_error());
?>
But When I run the page, it shows an error. I don't how to reform it.
Thanks!!

Reply to this topic