Jump to content

ffxpwns

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by ffxpwns

  1. It was an error in the code that was generating the output, wasn't it? No, I thought I had a solution, and I didn't, so I edited my post. But I'll try adding this :and r.referrer = u.nick after the where clause, see what happens. I think it's working, I think adding and r.email = u.email fixed it, but I'll do some testing.
  2. It was an error in the code that was generating the output, wasn't it? No, I thought I had a solution, and I didn't, so I edited my post. But I'll try adding this :and r.referrer = u.nick after the where clause, see what happens.
  3. Closer, here is the table it creates. That date registered value is someone else in the refer table with absolutely no relation to the user we're trying to to show the details for.
  4. Oh, the dates are every other users registration dates, but it leaves the one we wanted empty. Any ideas? Agin, my code is $query = "SELECT u.reg_date, u.nick, u.email FROM ". $DBPrefix."users AS u JOIN ". $DBPrefix."refer AS r WHERE r.referrer = '$userName'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); while($row = mysql_fetch_assoc($res)) { $template->assign_block_vars('refer', array( 'REGDATE => $row['reg_date'] )); }
  5. Well, I feel like a right proper dumbass. one weird thing though, I only have one row in 'refer' and the email has an account attached to it, but it shows up like this
  6. Oh, and because I'm lazy, $userName = $user->user_data['id']; so userName is ID.
  7. Alrighty. I modified the code to use ID's, but I may work on the code thing later. But how would I put these results on the TPL file? Currently it's $query = "SELECT u.reg_date, u.username, u.email FROM". $DBPrefix. "users AS u JOIN". $DBPrefix ."refer AS r WHERE r.referrer = '$userName'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); while($row = mysql_fetch_assoc($res)) { $template->assign_block_vars('fbs', array( 'REGDATE' => $row['reg_date'], )); } But it doesn't work, this error comes up: Database access error. SELECT u.reg_date, u.nick, u.email FROM Auc_users AS u JOIN Auc_refer AS r WHERE r.referrer = 'testuser' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS u JOIN Auc_ refer AS r WHERE r.referrer = 'testuser'' at line 2 page:/.../reflist.php line:42 Also, how would I display the data? Before I used $template->assign_block_vars('refer', array( 'REFEMAIL' => $row['email'], But I assume that would have to change
  8. This is going to be complicated to explain, so please bear with me. I have a tables called 'users' within that table, I have columns 'reg_date' (when the user registered) and 'email'. Then, I have a table called 'refer'. Within that, I have 'referrer' (who sent out a referral) and 'email' (who the referral email was sent to). When displaying this information, I want to display the day that someone registered (reg_date) when the email from 'users' equals the email from 'refer'. And it only displays this information to the 'referrer'. If that needs clarification, let me know. Here is my code so far: (The first query works totally fine. it's the second one) $userName = $user->user_data['nick']; // Get details $query = "SELECT email, date FROM " . $DBPrefix . "refer WHERE referrer = '".$userName."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); while($row = mysql_fetch_assoc($res)) { $template->assign_block_vars('refer, array( 'EMAIL' => $row['email'], 'DATE' => date('d/m/Y', $row['date']) )); } $query = "SELECT reg_date FROM " . $DBPrefix . "users WHERE email = 'email FROM " .$DBPrefix. " refer AND referrer = '".$userName."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); while($row = mysql_fetch_assoc($res)) { $template->assign_block_vars('refer', array( 'REFEMAIL' => $row['email'], )); }
  9. It did not. And, if it means anything, the permissions are 777.
  10. Would it work if I put it on another file and used it as in include? I'll try that and report back.
  11. In the common.inc.php, system is $system = new global_class();
  12. Also, when I use my old code (below) and I put the $refername or $referrer or whatever it is above the code, and I echo $query, it echos UPDATE DataBase_users SET balance = balance + 5 WHERE refer = ''. Almost as if it doesn't recognize it or something. And I'm sure my spelling is correct . I'm pretty sure PHP is out to get me. CODE: $query = "UPDATE ".$DBPrefix."users SET balance = balance + 5 WHERE refer = '".mysql_real_escape_string($referName)."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $gateway_data = mysql_fetch_assoc($res); $referName = $gateway_data['refer']; $query = "UPDATE ".$DBPrefix."users SET refer = '' WHERE nick = '".mysql_real_escape_string($referred)."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $gateway_data = mysql_fetch_assoc($res); $referred = $gateway_data['nick'];
  13. Thanks! Everyone love puppies. Now when I comment it out, no error is incited. But nothing happens to the balance / refer fields.
  14. I know it's frowned upon to bump a post, but I am so lost and I need to get this done. Could someone please help me figure out why I'm getting that error? This is how I feel.
  15. I meant that i didn't have to do anything radical with the page. I just ended up putting 'V_REFER' => (isset($_POST["TPL_refer"])) ? $_POST["TPL_refer"] : $_GET ['referrer'],
  16. And, somewhat unsurprisingly, just commenting it out does not work.
  17. And the call for userName does work, say I'm logged in as ffxpwns, I put in $userName = $user->user_data['nick']; then print_r ($userName); it says ffxpwns. So I assume that's not broken. This may seem super obvious to you, but PHP isn't my strongpoint.
  18. Well, major thing, it doesn't work. It says Fatal error: Call to a member function check_mysql() on a non-object in /.../html/pennybid/pay.php on line 18 And line 18 is shown in the group of text here (just to give context) $query = "SELECT refer FROM ".$DBPrefix."users WHERE nick = '".mysql_real_escape_string($n)."'"; $res = mysql_query($query); /*line 18 below*/ $system->check_mysql($res, $query, __LINE__, __FILE__); /*line 18 above*/ /* Should only be one result */ $row = mysql_fetch_assoc($res); $referName = $row['refer']; But anyways, I am calling $userName like so: $userName = $user->user_data['nick']; And I'll put it in context just to make sure I'm doing it right. function getReferName($n) { $query = "SELECT refer FROM ".$DBPrefix."users WHERE nick = '".mysql_real_escape_string($n)."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); /* Should only be one result */ $row = mysql_fetch_assoc($res); $referName = $row['refer']; return ($referName); } $userName = $user->user_data['nick']; $referName = getReferName($userName); // Who referred userName? $query = "UPDATE ".$DBPrefix."users SET balance = balance + 5 WHERE refer = '".mysql_real_escape_string($userName)."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $query = "UPDATE ".$DBPrefix."users SET refer = '' WHERE nick = '".mysql_real_escape_string($referName)."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__);
  19. I should add that it doesn't have to be that code, but thats what I wrote. If you think I need to change it, let me know.
  20. Dammit, I keep putting referral when I mean register. My bad.
  21. Seriously? So I don't need to do anything special with the URL or the page? just where the referral field is, I put somehting like $_GET['id'] and then I'd associate the ID with the username, and it'd fill out the feild?
  22. I want to have a URL that each person would have on their profile, to refer new users. What I'm thinking is the URL would be www.website.com/register.php?id=(users ID) Lets pretend that it's www.website.com/register.php?id=23 and the user with the ID 23's name is just 'testuser'. Then, when they open that page, it would be normal, but the 'referrer' field would have 'testuser' in it. Any ideas? I don't even know what to search because I don't know what to name that.
  23. Okay, I have posted before, but I truly cannot get this working. I wans a script where upon entering a page, if someone referred that person, they are awarded 5$. I thought I had it down, but it will not set the column 'refer' to null after the page laods, as it should. And it will not award the referrer with the money if the referrer has any information in their 'refer' column. Please let me know if that made sense or not, and I will try and clarify. Here is the code I'm trying to add: $query = "UPDATE ".$DBPrefix."users SET balance = balance + 5 WHERE refer = '".mysql_real_escape_string($referName)."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $gateway_data = mysql_fetch_assoc($res); $referName = $gateway_data['refer']; $query = "UPDATE ".$DBPrefix."users SET refer = '' WHERE nick = '".mysql_real_escape_string($referred)."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $gateway_data = mysql_fetch_assoc($res); $referred = $gateway_data['nick']; And heres the code I'm trying to add that ^ to. http://pastebin.com/rwcN7FeJ I tried adding it at around line 12. Theres one more thing, if I do this (code below) it does it correctly, but it clears all the 'refer' data for everyone, not just the one user. $query = "UPDATE ".$DBPrefix."users SET balance = balance + 5 WHERE refer = '".mysql_real_escape_string($referName)."'"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $gateway_data = mysql_fetch_assoc($res); $referName = $gateway_data['refer']; $query = "UPDATE ".$DBPrefix."users SET refer = ' ' "; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); Essentially, I want to do this: 'nick' 'refer' 'balance' --------+---------+---------+ | a | b | 0.00 | --------+----------+--------+ |b | c | 0 .00 | --------+----------+--------| |c | a | 0.00 | ------------------------------ Then user 'a' buys something, thus 'b' gets the bonus for referring them, and 'a' gets their refer set to a null value like: 'nick' 'refer' 'balance' --------+---------+---------+ | a | NULL | 0.00 | --------+----------+--------+ |b | c | 5 .00 | --------+----------+--------| |c | a | 0.00 | ------------------------------
  24. I must add, my table structure has columns called 'nick' (username) 'refer' (Who referred this person) and 'balance' There are a lot of other ones, but these are the ones that matter. So when someone signs up, they put in their referrers username and it does nothing. And when the referred user buys something, the referrer gets 5$. Here is my question. How would I write an UPDATE where the name in the refer field would award the referrer with +5 to balance, then it would clear the 'refer' field. I got the set refer to blank. Like this: +------+-------+------------+ | nick | refer | balance | +------+-------+------------+ | A | B | 0.00 | +------+-------+------------+ | B | C | 0.00 | +------+-------+------------+ A buys so B gets $5 added to his balance and the referrer is cleared from A, giving this after the update +------+-------+------------+ | nick | refer | balance | +------+-------+------------+ | A | | 0.00 | +------+-------+------------+ | B | C | 5.00 | +------+-------+------------+
×
×
  • 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.