Hello
I have a website that displays a series of records and a logo for each record. Each record is linked to an "id". Some records may have the same id, and therefore the same logo.
If there are no records displaying for a certain "id" I wish to delete the logo. So I am trying to print out a list of logo names I can then delete.
Table A holds the logo name, table B holds the record details. A and B are matched on the field "id". If table B's flag1 and flag2 are both set to 0, I get a list of logos using the code below:
<?php
require_once ('../mysql_connect.php');
$sql = "SELECT a.id, b.id, a.logo FROM a, b WHERE a.id=b.id AND b.flag1='0' AND b.flag2='0' GROUP BY a.logo";
$result=mysql_query($sql);
while($row = mysql_fetch_array($result)) {
echo "{$row['logo']}<br />";
}
?>
However. Suppose Table B holds two records for id 100 and one has both flags set to 0, but the other has both flags set to 1. In this case I do not wish the logo to be listed for deletion, as it is still valid. Only if every instance of id 100 have flag1 and flag2 set to 0 should the logo name be listed.
Apologies if I have not explained that very well!
And thank you for any advice.