<?php
$result=mysql_fetch_array(mysql_query("SELECT c.accession_number, location_id
FROM CARDBOX c, PRODUCT_LOOKUP pl, PRODUCTS p
WHERE p.product_id = ".$td[$i]['product_id']."
AND pl.product_id = p.product_id
AND c.cardbox_id = pl.cardbox_id "));
mysql_close(); ?>
<td <?php echo $style?>><?php echo $result['accession_number']?>_</td>
When having trouble with your queries, try using mysql_error(). Other tips that could have saved you some trouble can be found in the Debugging 101 thread over in the Echo Lounge (it's stuck to the top of the forum). One thing to consider doing is putting the query into a variable, and then putting the variable into mysql_query(). Then, if things go wrong, you can look in that variable to see what the query was that you actually sent to the DBMS (the aforementioned Debugging thread suggests a rather elegant way of doing this).
PS: and when writing PHP code here, try using [php] tags - it makes the stuff a lot easier to read.