i'm wondering how can i add an integer which i have assigned in a variable to a mysql table's column using INSERT.
this is my code:
//Connect to database
include ("connnect.php");
$countv = "10"
$insert = ("INSERT INTO table1 (id,count) VALUES ('$id',+$countv)";
mysql_query($insert) or die(mysql_error());
the count column is set to int and the default value is '0' Normally i add 10 using +10 , but now i want to try adding it via a variable. so i set "count" column to add $countv's value interger.
this script can add 10 to the column count, but when i try it the second time(which is using UPDATE table1 SET count = +$countv WHERE id='123') , it still remains as 10. is there any mistakes i'm making or is there a better way to do this?
Update script
mysql_query("UPDATE table1 SET count = + $countv WHERE id='123'")
or die(mysql_error());
Thanks and have a nice day.
(SOLVED : i forgotten to add count infront of + $countv in the update script. thanks for those who help)