Re: Check for duplicates

From: Date: Wed, 29 Nov 2000 10:09:52 +0000
Subject: Re: Check for duplicates
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27928@lists.php.net to get a copy of this message
Can't say other then it would be cleaner this way $db = mysql_connect("www.myserver.com", username, password); mysql_select_db("databasename",$db); function find($processname, $processid, $realname) { $checksql = "SELECT * FROM tablename ORDER BY mailid"; $checkresult = mysql_query($checksql); while ($checkrecord = mysql_fetch_array($checkresult)); { $thisrecord = strtoupper(trim($checkrecord["email"])); $thisid = $checkrecord["mailid"]; echo "<font size='1'><B>\n"; if ($processname == $thisrecord AND $processid != $thisid) echo "Check # $processid ($realname) and # $thisid ({$checkrecord["email"]})!<BR>\n"; echo "</B></FONT>\n"; } } Try running the query from the mysql command line? how many results does it turn up? try getting rid of all the font stuff, make the html as small as possible, maybe its not PHP, Ive had netscape chok an really big tables, maybe its choking here. Chris Lee Mediawaveonline.com In article <006301c05a5c$94dee2e0$25549318@ne.mediaone.net>, murph@murphatnight.com wrote: > Hi. I have a database of just over 1200 names and addresses where I know > there are some duplicates in it. The server seems to choke on the > following code and I wonder if anyone has any suggestions. I get an > "Internal Server Error" after processing about 300 MySQL records in this > way: > > <?php > > $db = mysql_connect("www.myserver.com", username, password) OR > DIE("Unable > to connect to database"); mysql_select_db("databasename",$db); > > function find() > { > > global $processname; global $processid; global $realname; > set_time_limit(0); > > $checksql = "SELECT * FROM tablename ORDER BY mailid"; > $checkresult = mysql_query($checksql) or die ("Can't pick the current > record up"); > > if ($checkrecord = mysql_fetch_array($checkresult)); > { > do > { > $thisrecord = strtoupper(trim($checkrecord["email"])); > $thisid = $checkrecord["mailid"]; > > if ($processname == $thisrecord && $processid != $thisid) > { > echo "<FONT SIZE=\"1\"><B>Check #" . $processid . > " (" . > $realname . ") " . "and #" . $thisid . " (" . > $checkrecord["email"] . > ")!</B></FONT><BR>"; > } > } > while ($checkrecord = mysql_fetch_array($checkresult)); > mysql_free_result($checkresult); > } > } > > > $sql = "SELECT * FROM tablename ORDER BY mailid"; > $result = mysql_query($sql) or die ("What, I can't even grab a > record?!?"); > > if ($myrow = mysql_fetch_array($result)) > { > $count = 0; > do > { > $processname = strtoupper(trim($myrow["email"])); > $processid = trim($myrow["mailid"]); > $realname = $myrow["email"]; > echo "<FONT SIZE=\"1\">Checking #" . $processid . ": > " . > $myrow["email"] . " against the database.<BR></FONT>"; > find($processid); > } > while ($myrow = mysql_fetch_array($result)); > mysql_free_result($result); > } > > ?> > > > > www.murphatnight.com > __________________________________________________________________ > Brian Murphy - 193A Lowell St., Apt. 24 - Methuen, MA 01844 - (978) > 725-6654 > >

« previous php.general (#27928) next »