I have a MySQL join query which works well (disclaimer: taken from tutorial):
<?php
$connection = mysql_connect("localhost", "root", "test") or die("Error connecting to database");
mysql_select_db("products90", $connection);
$result = mysql_query("SELECT * FROM buyers LEFT JOIN products USING (id);", $connection) or die("error querying database");
$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
?>
<table>
<tr <?php if($i%2 == 1){ echo "class='body2'"; }else{echo "class='body1'";}?>>
<td>
<?php echo $result_ar['buyer_name']; ?></td>
<td>
<?php echo $result_ar['manufacturer']; ?>
</td>
<td>
<?php echo $result_ar['product_name']; ?>
</td>
</tr>
</table>
<?php
$i+=1;
}
?>
However, if I wanted it to ignore NULL results, what would I need to do with the JOIN, which type is appropriate?
I had a look on Google, but am not sure where to proceed from here.