Quote Originally Posted by snowy2007 View Post
Would this bit of code do the trick to add 200 points to each customer? :

PHP Code:
<?PHP

$user_name 
"username";
$password "password";
$database "databasename";
$server "localhost";
$db_handle mysql_connect($server$user_name$password);
$db_found mysql_select_db($database$db_handle);

if (
$db_found) {

$SQL "SELECT * FROM customers";
$result mysql_query($SQL);

while (
$db_field mysql_fetch_assoc($result)) {
    
$custid=$db_field['customers_id'];

    
$SQLINSERT "INSERT INTO reward_customer_points (customers_id, reward_points)" 
                
" VALUES ('$custid', 200)";
        
                 
$rows mysql_query($SQLINSERT); 

    if(!
$rows) { 
            
$message "Insert error: " mysql_error(); 
            } 
}

mysql_close($db_handle);

}
else {
print 
"Database NOT Found ";
mysql_close($db_handle);
}

?>
That should do it. If you "include 'application_top.php'" you could use the function UpdateCustomerRewardPoints($customer_id,$reward_points,$pending_points) which will append the points to any customer that already has points.