Jump to content

Postback api php and sql issue


Talos1

Recommended Posts

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/281967-postback-api-php-and-sql-issue/
Share on other sites

Like Barand said, your problem isn't exactly clear.  We're not in the room with you.  So, ask a better question, which includes what you're trying to do, what the expected results should be, what the actual results are (including all errors and warnings), and the relevant code (including database schema).

after reading the post a few times, i'm guessing you want to SELECT the ref1 value WHERE id = '$user' and then run an UPDATE query to add the .001 to the ref1 user's money or you could do this in one UPDATE query with a sub-query to get the ref1 value.

 

where exactly are you stuck at in doing this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.