View Single Post
  #1 (permalink)  
Old 08-07-2008, 03:10 AM
EternalWolf EternalWolf is offline
Registered User
 
Join Date: Aug 2008
Posts: 3
Parse Error: Adding to currently existing data

Hello, my name is Vince.

I'm trying to make a php script to acces my mysql database.
currently, im using an html form to post a input field to the php file.
I need to add 1000 to the currently existing data, which is only numeric by the way.

here is the code below;

PHP Code:
<?php
$username 
$_POST['entered_username'];


$dbhost 'mysql3.freehostia.com';
$dbuser 'vinmar10_net';
$dbpass 'Master';

$sql_query mysql_connect($dbhost$dbuser$dbpass) or die                      ('Error connecting to mysql');

$dbname 'vinmar10_net';
mysql_select_db($dbname);




$sql_query mysql_query("SELECT `extcredits2` FROM `cdb_members` WHERE `username` = '$username'");
while(
$rs mysql_fetch_array($sql_query)) {
$creditamt $rs[0] + 1;
}

$sql_query "UPDATE cdb_members SET $creditamt = extcredits2 +1000 WHERE username = $username";
if(
mysql_query($sql_query)) {
echo 
"Credits Purchased Successfully";
}
?>
can someone please help me figure out why this error occurs?
Reply With Quote