October 12th, 2000, 01:05 PM
i'm using php and mysql to do a project for my school. when i read in the data from the database i need it to check to see if any of the data is the same and if it is to only print out 1 of the items. for example..at one part i'm reading in 4 items of data that are all '11/10/00 7:00 AM'. i need my script to read through and see if there are more then one and if there are to only print out one. could someone help me out? thanks.
October 12th, 2000, 01:19 PM
But I think instead of putting this logic in the script, let the mysql help you out.
$query = "SELECT DISTINCT owner FROM pet";
$result = mysql_query($query);
This should only return rows that are unique in the table. (no dupes)
The mysql manual goes into further detail about "destinct".
Hope this helps,