I'm trying to add a number to the value of a column in my db but I'm having no such luck in doing this. Heres my code:
I just want to add 7 to the current value.PHP Code:<?php
session_start();
require_once('../config.php');
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Error: '.mysql_error ());
}
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die('Error: '.mysql_error ());
}
$result = mysql_query("SELECT * FROM members") or die ('Error: '.mysql_error ());
while($row = mysql_fetch_array($result))
{
$points = $row['points'];
$points += 7;
}
$result = mysql_query("UPDATE members SET points=$points WHERE ia11='North Carolina'")
or die(mysql_error());
mysql_close($link);
?>


Reply With Quote

Bookmarks