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
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).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.