Re: Checking Post Data against DB Data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I really like the re-coding it's great.  I'm still new and below code is 
definitely more efficient.

FYI: I do have date field sorry I wasn't so clear.  I just didn't post all 
code.

""Richard Lynch"" <ceo@xxxxxxxxx> wrote in message 
news:1707.24.1.37.132.1184193310.squirrel@xxxxxxxxxxxxxxxx
> Doing a select to get every record, and then looping through them all,
> concatenating a bunch of stuff together, and then using PHP to test ==
> is not very efficient...
>
> Why not just:
>
> $sql = array_map('mysql_real_insert_string', $POST);
> $query = " select count(*) from central ";
> $query .= " where conName = $sql[conName] ";
> $query .= "   and conAddress = $sql[conAddress] ";
> .
> .
> .
> $query .= "   and SOME_DATETIME_FIELD_WHEN_THEY_REGISTERED >=
> date_sub(now(), interval 1 day) ";
>
> Also note that your are currently comparing the $_POST['timeStamp']
> which is *probably* generated at the time the HTML form was sent with
> time(); which is when the script is processing, which will be MUCH
> less than one day, unless a user opens up the form, walks away for 24
> hours, and then comes back to complete registration...
>
> You need a field in the database from previous registration to compare
> to time().

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux