[snip]
Thank you for the email. Following is the php code
but it doesn't work.
<?
include ("connect_my_db.inc");
connect_my_db();
$result = mysql_query ("SELECT DISTINCT id FROM
my_rank WHERE rank='a'");
while ($row = mysql_fetch_array($result))
{
$id = 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>";
}
}
?>
[/snip]
Try your $query like this...
$query ="
SELECT id
FROM my_rank
WHERE id LIKE '$id%'
GROUP BY id
HAVING COUNT(*) > 1
";
Single quotes around $id%, and if it is PHP they don't need to be escaped.
After your query, while testing, place this code to catch error reports...
if(!($dbresult = mysql_query($query, $dbconnect))){
print("MySQL reports: " . mysql_error() . "\n");
exit();
}
You may have to modify the code to place the correct connection variable. If
you can send me one record, and a description of what you are doing, I will
try to help.
Jay Blanchard
---------------------------------------------------------------------
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