Im getting weird output with this one. Basically Im having it scavenge my database zip code field for any fields longer than 5 (the length of a zip code). A few of my zip fields have full addreses in them due to a crappy script that went through it to 'fix' them.
Now, I get this as output:
Messed up entry:
Messed up entry:
Messed up entry:
Messed up entry:
Resource id #5
Messed up entry:
Resource id #6
Messed up entry:
Heres my code:
<?php
include 'include.php';
$query = mysql_query("SELECT zip FROM shops");
while($array=mysql_fetch_array($query)){
// How big is it? Heh.
$length = strlen($array["zip"]);
// If its NOT length 5, then warn
if(!($length == 5)){
// Query the entry
$query2 = mysql_query("SELECT zip FROM shops WHERE zip = '$array[zip]'");
// Echo out entry
echo "Messed up entry: <br>";
echo $query2;
echo "<br><br>";
}
else{
// do nothing
}
}
?>
For the record, my zip field is text. It (should) contains zip codes. This script is to find the non-conformists. Also, Im using the newest version of EasyPHP.
Edited by rc69, 03 July 2007 - 11:56 PM.
