Dear All,
My record id is 10 char long, all records are unique.
However, many of these ids consist of _____. Trying to
print all matching records with first eight characters
of the id. For some weird reason, it's not working
properly. Any comments or help will be greatly
appreciated. Blow is my php code:
<?
include ("connect_my_db.inc");
connect_my_db();
$result = mysql_query ("SELECT id FROM my_rank");
while ($row = mysql_fetch_array($result))
{
$id8 = substr("$row[id]", 0, 8);
$query = "
SELECT id
FROM my_rank
WHERE id LIKE \"$id%\"
GROUP BY id
HAVING count(*) > 1
";
$result1 = mysql_query($query);
while ($row = mysql_fetch_array($result1))
{
echo "$row[id]<br>";
}
}
?>
Best regards,
James
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php