|
|
|
|
|
Re: Script problem [message #165249 is a reply to message #165241] |
Tue, 17 May 2011 03:01 |
Ernesto
Messages: 413 Registered: August 2005
Karma: 0
|
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.
Ginnunga Gaming
|
|
|
|