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 #165249 is a reply to message #165241] Tue, 17 May 2011 03:01 Go to previous messageGo to previous message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma:
Senior Member
Now you are looping through you entire database until you find a match, it would make much mroe sense to not select anything at all.

First, you grab the $_GET, then you make sure it is clean.

$queryString = mysql_real_escape_string($_GET['code']);

(Read about SQL injections)

After that, you just
$sql = 'UPDATE membre SET status=1 WHERE activationkey = '.$queryString;


With your way you take ALL members from the database, loop though them in PHP until you find the match. That is not a good way, PHP is not made for looping that amount of data, however, that is JUST what an SQL server is made for, it can do it in a 100th of the time with a 100th of the effort. Imagine if you have a million users, it would take PHP days to loop it and it would take huge power to bring all the data from the database to the PHP layer.


[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: Sat May 11 05:34:37 GMT 2024

Total time taken to generate the page: 0.06847 seconds