Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Postback api php and sql issue

$
0
0

Hello,

 

after 3 hours of insanity i figured i would reach out for some help. i am re-building a postback file that works off an API. i have got it to pay my members, but thr their referral person.

 

Below is the code:

<?
$user = @$_GET['user'];

$reward = @$_GET['reward'];

$atefa = "alikiwife";
$date = date(“format”, $timestamp);
$dates = date('d/m/Y - H:ia');
$entry_line = "$dates - $user has just completed Virool offer worth $reward PED.
"; //give ENTER to break into new line in text file

$fp = fopen("cback.txt","a");
fputs($fp,$entry_line);
fclose($fp);

$con = mysql_connect("localhost","dbname","password");
 if (!$con)
   {
   die('Could not connect: ' . mysql_error());
   }

 mysql_select_db("dbname", $con);

 mysql_query("UPDATE members SET money=money+$reward, vwall=vwall+1 WHERE id='$user'");

 mysql_close($con);
?>

Now here is the issue, there is a field under each member in the database that is labled 'ref1' which is the id of the person who referred the member. The code line below pays the member the ammount due. but i need to add it to pay the refferer .001 or in essense 'ref1 money=money+.001' my problem is that i cannot get it to first call on the ref1 field so it is acutally editing the member who is the referer and edit their money field.

 

This is the particular line i am having issues with. any suggestions would be greatly appreciated.

mysql_query("UPDATE members SET money=money+$reward, vwall=vwall+1 WHERE id='$user'");

Thanks in advance, i am going crazy not being able to figure this out.

 

 


Viewing all articles
Browse latest Browse all 13200

Trending Articles