[nycphp-talk] Timeouts ... how to get around it?
Glenn
glenn310b at mac.com
Tue Oct 14 08:03:02 EDT 2008
Hi,
Getting those 13000 into the db would be a good thing.
Then you could index the email cols in both tables, and
just do a join on the tables.
In the meantime, maybe try getting ALL of the email values
from the db into an associative array, (email => 1) and looping
over an "array_key_exists". When you find a key match, THEN
look up the full record in the db.
hth,
Glenn
On Oct 14, 2008, 1:57 AM, mikesz at qualityadvantages.com wrote:
> Hello NYPHP,
>
> I have an array that has 13000 email addresses. For now, its in the
> script but will be in a database table eventually. It is a list of
> known bad guys.
>
> I have a database table with 9000 records and one of the fields is
> an email address.
>
> In PHP I am using a foreach to loop through the array and do a
> database lookup to try to find any matching emails.
>
> I am using this query inside the foreach loop:
>
> $res = ("SELECT * FROM `table` WHERE `email` = '$email2Chk'");
> $numRows = mysql_num_rows($res);
> if ( !empty($numRows ))
>
>
> It processes about 12000 addresses in the array and the script
> times out.
>
> Anyone have a better idea for doing this task?
>
> TIA for any help.
>
> --
> Best regards,
> mikesz mailto:mikesz at qualityadvantages.com
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
More information about the talk
mailing list