First time posting here so it is nice to meet you all.
I have been teaching my self php for a few weeks now and I have hit a brick wall
Using the following code I have been able to add or subtract values in a column within my SQL table:
Code: Select all
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot SELECT DB");
//Add query
$sql = mysql_query("UPDATE UserList SET Rewards = (Rewards + 10) WHERE Username LIKE '%$add%'");I tried:
Code: Select all
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot SELECT DB");
//Add query
$sql = mysql_query("UPDATE UserList SET Rewards = (Rewards + '%$addvalue%') WHERE Username LIKE '%$add%'");Code: Select all
<form action="add_points.php" method="post" class="style13">
<input name="add" type="text" id="add" />
</label><label>
<select name="addvalue" id="addvalue">
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
</select>
</form>Any help anyone can provide would be really appreciated.
Many Thanks
PQ