1

I am running a CPA site and needs instant tracking of offers completed by my users through my site but the postback script I am using is not working it is not changing the value of amount in my database. Below is the script:

<?php 

$dbhost = 'host';
$dbuser = 'user';
$dbpass = 'pass';
$dbname = 'name';

// 2. Create a database connection
$connection = mysql_connect($dbhost,$dbuser,$dbpass);
if (!$connection) {
    die("Database connection failed: " . mysql_error());
}

// 3. Select a database to use 
$db_select = mysql_select_db($dbname,$connection);
if (!$db_select) {
    die("Database selection failed: " . mysql_error());
}

$subid = $_REQUEST['subid'];
$amount = $_REQUEST['payout'];

mysql_query("UPDATE users SET amount=amount+".$amount." WHERE id='".$subid."'");

   echo "<b>Amount Credited:</b> Rs ".$amount.";      

?>
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
HELPER
  • 23
  • 4
  • 1
    just be aware of [SQL Injection](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php). – Aᴍɪʀ Dec 28 '15 at 06:57
  • please help since i am a newbie to php what changes should i do to my script – HELPER Dec 28 '15 at 07:04
  • Please read the link I post in my previous comment. And update your question and add your javascript as well. – Aᴍɪʀ Dec 28 '15 at 07:07

0 Answers0