ok what have i done wrong :(

Reply

Join Date: Feb 2007
Posts: 4
Reputation: blackpheonix is an unknown quantity at this point 
Solved Threads: 0
blackpheonix blackpheonix is offline Offline
Newbie Poster

ok what have i done wrong :(

 
0
  #1
Feb 11th, 2007
Just wondered if anyone could help me, what am i doing wrong here im trying to cant seem to get $email, $betakey or $userid to show any data i know im missing something but for teh life of me cant think tried everything i could think of fetch etc but to no avail please help

  1. <?
  2. session_start();
  3. include "includes/db_connect.php";
  4.  
  5.  
  6. $accepted=$_POST['accepted'];
  7. {
  8. mysql_query("UPDATE users SET accepted='yes' WHERE username='$accepted'");
  9. mysql_query("SELECT * FROM users WHERE username='$accepted' AND betakey='$betakey' AND id='$userid' AND email='$email'");
  10.  
  11. $sendto = "$email";
  12. $subject = "You've Been Accepted";
  13. $message = "Congratulations $accepted, You have been selected to beta test GAME NAME.
  14. Click To Activate Your Beta Account: http://www.gameurl.com/betaactivate.php?id=$userid&code=$betakey
  15.  
  16. Beta Information:
  17. Username: $accepted
  18. Beta Key: $betakey
  19. Hope You Enjoy
  20. GAME NAME Staff.
  21. This is an automated response, please do not reply!";
  22. mail($sendto, $subject, $message,
  23. "From: GAME NAME<admin@gamename.com>");
  24. print "You made $accepted a beta tester ";
  25. }
  26. ?>

and the email i recieve (when i add my own email addy in $sendto) looks like this:

Congratulations testbeta, You have been selected to beta test GAME NAME.

Click To Activate Your Beta Account: http://www.gameurl.com/betaactivate.php?id=&code=


Beta Information:
Username: testbeta
Beta Key:

Hope You Enjoy
GAME NAME Staff.

This is an automated response, please do not reply!
Last edited by blackpheonix; Feb 11th, 2007 at 12:18 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 4
Reputation: blackpheonix is an unknown quantity at this point 
Solved Threads: 0
blackpheonix blackpheonix is offline Offline
Newbie Poster

Re: ok what have i done wrong :(

 
0
  #2
Feb 11th, 2007
anyone ?
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 37
Reputation: jblacdao is an unknown quantity at this point 
Solved Threads: 3
jblacdao jblacdao is offline Offline
Light Poster

Re: ok what have i done wrong :(

 
0
  #3
Feb 15th, 2007
You used the variables but never assigned any value to them before you used them. Are they supposed to get their values from a previous form? If so, you have to assign it to them before you use them.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 4
Reputation: blackpheonix is an unknown quantity at this point 
Solved Threads: 0
blackpheonix blackpheonix is offline Offline
Newbie Poster

Re: ok what have i done wrong :(

 
0
  #4
Feb 19th, 2007
basicaly i want ppl to sign up for beta testing and then i want to be able to accept ppl individualy so the first part works fine it adds there email,userid and username to the database and also adds a random number to the betakey field and then sends me an email saying username has requested to be a beta tester that works all fine, then i go into my admin panel and select ppl from my email ie username qwerty wants to be a beta tester so i add qwerty in the form click submit now what i want to do is send qwerty an email (using the email already in the database) containing his/ her username their userid and there unique beta registration key. hope that makes sense
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 37
Reputation: jblacdao is an unknown quantity at this point 
Solved Threads: 3
jblacdao jblacdao is offline Offline
Light Poster

Re: ok what have i done wrong :(

 
0
  #5
Feb 19th, 2007
Yes, but what I was saying is that based from your script you are trying to use variables for which their variables have not been set, meaning they have null or empty values. Now, judging from your script you can try changing:

mysql_query("SELECT * FROM users WHERE username='$accepted' AND betakey='$betakey' AND id='$userid' AND email='$email'");

to:

$result = mysql_query("SELECT * FROM users WHERE username='$accepted'");
 
$record = mysql_fetch_array($result, MYSQL_ASSOC);
if (!empty($record))
{
$betakey = $record['betakey'];
$userid = $record['userid'];
$email = $record['email'];
}
else
{
// Insert error handler/User notification that sending of email has failed
}


Try it out and let me know if it still doesn't work
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 4
Reputation: blackpheonix is an unknown quantity at this point 
Solved Threads: 0
blackpheonix blackpheonix is offline Offline
Newbie Poster

Re: ok what have i done wrong :(

 
0
  #6
Feb 19th, 2007
it worked nice one thanks
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 37
Reputation: jblacdao is an unknown quantity at this point 
Solved Threads: 3
jblacdao jblacdao is offline Offline
Light Poster

Re: ok what have i done wrong :(

 
0
  #7
Feb 20th, 2007
ur welcome! glad to be of assistance
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC