944,027 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1610
  • PHP RSS
Feb 11th, 2007
0

ok what have i done wrong :(

Expand Post »
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

php Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
blackpheonix is offline Offline
4 posts
since Feb 2007
Feb 11th, 2007
0

Re: ok what have i done wrong :(

anyone ?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
blackpheonix is offline Offline
4 posts
since Feb 2007
Feb 15th, 2007
0

Re: ok what have i done wrong :(

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.
Reputation Points: 12
Solved Threads: 3
Light Poster
jblacdao is offline Offline
37 posts
since Jan 2007
Feb 19th, 2007
0

Re: ok what have i done wrong :(

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
blackpheonix is offline Offline
4 posts
since Feb 2007
Feb 19th, 2007
0

Re: ok what have i done wrong :(

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
Reputation Points: 12
Solved Threads: 3
Light Poster
jblacdao is offline Offline
37 posts
since Jan 2007
Feb 19th, 2007
0

Re: ok what have i done wrong :(

it worked nice one thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
blackpheonix is offline Offline
4 posts
since Feb 2007
Feb 20th, 2007
0

Re: ok what have i done wrong :(

ur welcome! glad to be of assistance
Reputation Points: 12
Solved Threads: 3
Light Poster
jblacdao is offline Offline
37 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Urgent help needed > uploading video files
Next Thread in PHP Forum Timeline: Query class problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC