come hai postato va bene, al massimo puoi fare tutto in php (SE E' QUELLO CHE CHIEDI):
Codice PHP:
echo "<table width=\"100%\" border=\"1\">";
echo 
"<tr><th width=\"15%\">Codice</th></tr>"
while(
$righe mysql_fetch_array($sql))

 echo 
"<tr><td width=\"15%\">".$righe['tb_acquisti_idprod']."</td></tr>"

echo 
"</table>"