Hi,

Somebody please help me, i am going mad out of my mind, for the past 4 hours or so some silly little problem has ratteled my brain and i cannot fix it.

Basically, user registers on site, they get there activation email, click on link and the below script should then update the database.

Problem is it is not doing that.

I have tried possibly everything and nothing seems to work. Althou registration page communicates with DB fine and does what it suppose to, the script below uses the same db_connect.php file as the registration page. I get no errors or nothing.

basically the status field is verify when user registers and wehn they activate there account by clciking on link the script below suppose to change it to activated but also at the same time remove the activation key from the activationkey field.

Yep, you guessed it, it dont bother doing it. It is almots if like the db connection closes or something before PHP reads the part that tells it to communicate with DB to update it. I have checked spelling etc and that seems fine, and just not got a clue.

What is more strange is it must be communicating with the DB as it is able to retrieve the users username and it displays it like it suppose to after Thank you (username), The only thing i can think of is the update query i am not doing it rite or someting.

Ok, here is the script. Does anyone see anything wrong with it?

Please god i hope i fix this, it has been driving me crazy for past several hours.

<?php include("db_connect.php"); // Database Connection ?>
<?php @include("top.inc"); ?>



<?php

// Verify activation code then change activation code to null and change status from verify to activated.

$queryString = $_SERVER['QUERY_STRING'];

$query = "SELECT * FROM userinformation"; 

$result = mysql_query($query) or die(mysql_error());

  while($row = mysql_fetch_array($result)){

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

       echo "Thank you <b>" . $row["username"] . "</b>,
	   <p>Your account is now activated. We will redirect you to the login page in 10 seconds.</p>";

       $sql = "UPDATE userinformation SET activationkey = ' ', status='activated' WHERE (id = $row[id])";
	   
	   redirect( "login.php" , "10" );
	   

  {

        die('Error:' . mysql_error());

  }

    }

  }

?>

<?php @include("footer.inc"); ?>

anyone have any idea please?

I am still trying to find a solution to a problem that i cannot make sence of.

Thank you,
genieuk

after this line $sql = "UPDATE userinformation SET activationkey = ' ', status='activated' WHERE (id = $row[id])"; execute the query mysql_query($sql) or die(mysql_error());

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.