Not writting to database..Please help

jdoyle55's Avatar, Join Date: Apr 2010
Newbie Member
I purchased this script in PHP and it's not writting to the database. Irf someone could have a look and tell me why I sure would appreciate it the code is :
PHP Code:
<?
include("common.php");
$link = mysql_connect($dbhost, $dbuser, $dbpassword)
or die("Could not connect: " . mysql_error());
  mysql_select_db($dbname);
  $sSQL="select n_ID, n_RefererID from t_Users where b_Activated<>1 and s_Username=\"".stripjunk($username)."\" and n_Rand=".stripjunk($rand);
  $results=mysql_query($sSQL);
  if(mysql_num_rows($results)==0)
  {
  include ("header.php");
   echo "Sorry, either you followed a broken link, the account specified is already active, or it doesn't exist";
    include ("footer.php");
  }
  else
  {
   list($n_ID, $n_RefererID)=mysql_fetch_row($results);
 $sSQL="update t_Users set b_Activated=1 where n_ID=$n_ID";
 mysql_query($sSQL);
 $sSQL="update t_Users set n_Credits=n_Credits+$referral_credits where n_ID=".stripjunk($n_RefererID);
 mysql_query($sSQL);
   include ("header.php");
 echo "Congratulations, your account is now active, please click <a href=./login.php>here</a> to log in";
    include ("footer.php");
  }
mysql_close();
?>

Last edited by shabbir; 14Apr2010 at 06:34.. Reason: Code blocks
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Ask the support from where you purchased the script because there may be many reasons and one of them could be that database does not exist and other could be permission of user.