FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » Script problem (Scritpt doesn't update database in email validation)
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Return to the default flat view Create a new topic Submit Reply
Script problem [message #165233] Fri, 13 May 2011 08:40 Go to previous message
anemic-cinema is currently offline  anemic-cinema   France
Messages: 4
Registered: May 2011
Location: Paris
Karma:
Junior Member
add to buddy list
ignore all messages by this user
Hi everybody, I'm a newbie to this forum. My name is Andrea and I'm Italian.
So, to get to the point i want to learn php and I'm trying to write an email validation script but I don't understand where I make a mistake.
I've already created a page (inscription.php) where someone can register himself and then an email is sent to his email box.
Register page creates and store in mysql database an activation key that it is also sent to the user
The Url included in the message calls another php page (verify.php) that compares the activation key with that stored in mysql and actives user account.
It seems to run but when i check the database, it isn't updated.
Could anyone suggest me the way to solve it?
Thank you very much and sorry if my English isn't good.

<?php
mysql_connect("localhost", "emailval", "emailval") or die(mysql_error());

mysql_select_db("emailval") or die(mysql_error());

$queryString = $_SERVER['QUERY_STRING'];

if(isset ($queryString)) {

    	$query = "SELECT * FROM membre"; 

	$result = mysql_query($query) or die(mysql_error());
	
	while($row = mysql_fetch_array($result)) {

	if ($queryString == $row["activationkey"]){

	echo "Congratulations!" . $row["login"] . 
	" is now the proud new owner of an TEST.com account.";

       	$sql="UPDATE membre SET activationkey = '', 
	status='activated' WHERE (id = $row[id])";

	} else {

         echo "error";

  	}

}

}
    
?>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Usenet group import
Next Topic: Choose PHP Framework Tips
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Oct 22 08:11:17 EDT 2017

Total time taken to generate the page: 0.00656 seconds