Welcome, Guest. Please Login or Register.
June 23, 2024, 08:05:10 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  What's wrong with this code? « previous next »
Pages: [1] Reply Ignore Print
Author Topic: What's wrong with this code?  (Read 913 times)
Kalin Somphane
YaBB God
*****
Posts: 555


I am personal text!

ICQ - 20280987 WWW
What's wrong with this code?
« on: January 04, 2002, 06:04:58 PM »
Reply with quote

   if($member['refname'] != "") {
      $request2 = mysql_query("INSERT INTO {$db_prefix}referrers (et_referrer,et_referred,date) VALUES('$member[refname]','$member[user]','$requesttime')");
      $request3 = mysql_query("SELECT referred FROM {$db_prefix}members WHERE memberName='$member[refname]'");
      $referredcount = $request3["referred"];
      $asdf = $referredcount;
      $cheares="it works";
      $cheares2 = $member["refname"];
      $referredcount++;
      $request = mysql_query("UPDATE {$db_prefix}members SET referred='$referredcount' WHERE memberName='$member[refname]'");
   }
Logged

EZTARCH - The Original YaBBSE PHP Portal
Unlike many others, I accept support requests, in exchange for godly worship every weekday including saturday and sunday.
Zef Hemel
Advisor
YaBB God
*****
Posts: 1182


Me too

ICQ - 61109769 WWW
Re:What's wrong with this code?
« Reply #1 on: January 04, 2002, 06:07:30 PM »
Reply with quote

What error do you get? What is the code supposed to do?

Just some questions popped up in my mind ;)
Logged

Joseph Fung
Global Moderator
YaBB God
*****
Posts: 4512


Keep smiling: it makes others nervous.

WWW
Re:What's wrong with this code?
« Reply #2 on: January 04, 2002, 06:08:11 PM »
Reply with quote

one error is this
$request3 = mysql_query("SELECT referred FROM {$db_prefix}members WHERE memberName='$member[refname]'");
      $referredcount = $request3["referred"];

change it to

$request3 = mysql_query("SELECT referred FROM {$db_prefix}members WHERE memberName='$member[refname]'");
$row = mysql_fetch_array($request3);
      $referredcount = $row["referred"];

Logged

Joseph Fung
Global Moderator
YaBB God
*****
Posts: 4512


Keep smiling: it makes others nervous.

WWW
Re:What's wrong with this code?
« Reply #3 on: January 04, 2002, 06:09:25 PM »
Reply with quote

and, in the interest of saving resources, you could use $request for all of the queries as opposed to $request, $request2 and $request3
Logged

Kalin Somphane
YaBB God
*****
Posts: 555


I am personal text!

ICQ - 20280987 WWW
Re:What's wrong with this code?
« Reply #4 on: January 04, 2002, 06:16:06 PM »
Reply with quote

Wow that was soooo quick. :)

But it seems that this sql query is not working. And this is in the register.php file. I am wondering if I should just do the full protocol to get to the table.

Quote$request2 = mysql_query("INSERT INTO {$db_prefix}referrers (et_referrer,et_referred,date) VALUES('$member[refname]','$member[user]','$requesttime')");
Logged

EZTARCH - The Original YaBBSE PHP Portal
Unlike many others, I accept support requests, in exchange for godly worship every weekday including saturday and sunday.
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  What's wrong with this code? « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.176 seconds with 21 queries.