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 :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Script problem [message #165241 is a reply to message #165240] Sun, 15 May 2011 20:23 Go to previous messageGo to previous message
anemic-cinema is currently offline  anemic-cinema   France
Messages: 4
Registered: May 2011
Location: Paris
Karma:
Junior Member
Hi, thank you! I found your advices very helpful and I tried to follow them.
Now the script is something like that:

<?php

// Connect to database
$base = mysql_connect ('localhost', 'emailval', 'emailval');
mysql_select_db ('emailval', $base);

// Get Activation Key in the email URL
$queryString = ($_GET['code']);
$result = mysql_query('SELECT * FROM membre') or die(mysql_error());
$row = mysql_fetch_array($result);

        // Compare sent activationKey with stored activationKey
        if  ($row['activationkey'] == $queryString) {
                
                // Update databse
                $sql = "UPDATE membre SET  status='1' WHERE (id = $row[id])";
                $req = mysql_query($sql) or die('Erreur SQL !'.$sql.'<br />'.mysql_error());
                
                // Congratulations on registration
                echo "Congratulations!." . $row['login'] ." You are a new membre of TEST.COM ";
                
                // Close connection
                mysql_close ($base);
                include("index.php");
        } else {

        // Get an error
        die('Error: ' . mysql_error());
        }

?>




What do you think about it? Is it right?

Thank you very much!
[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 Dec 01 12:03:23 GMT 2024

Total time taken to generate the page: 0.04981 seconds