Forums

This topic is locked

Clever with Form Update Feature

Posted 27 Aug 2008 18:00:05
1
has voted
27 Aug 2008 18:00:05 Adele Lezar posted:
I am currently trying to update my database var by adding 1 to my entries variable each time someone enters the same Voucher_ref number

this is my code but its not working
HOW DOES ONE ADD TO A VARIABLE IN YOUR DATABASE THROUGH DREAMWEAVER UPDATE
------------------------

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1") {
$updateSQL = sprintf("UPDATE competition SET entries = entries + 1 WHERE voucher_ref=%s",

GetSQLValueString($_POST['voucher'], "text");

mysql_select_db($database_octoblu, $octoblu);
$Result1 = mysql_query($updateSQL, $octoblu) or die(mysql_error());
}

-----------------------------

Replies

Replied 28 Aug 2008 20:13:41
28 Aug 2008 20:13:41 Alan C replied:
Hi
I think you can do that directly in sql without having to read the actual values, something like this will do it . . . .

UPDATE table_name SET column_name = column_name + 1 WHERE <where_condition>;

Reply to this topic