How do I apply CSS Style to PHP code output
Posted: Tue Aug 23, 2005 10:15 am
Hi,
I have some code which outputs data from a database into a table and I would like to know how I can apply a style to this output, from my stylesheet. Here is the code;
I have some code which outputs data from a database into a table and I would like to know how I can apply a style to this output, from my stylesheet. Here is the code;
Code: Select all
mysql_select_db("audit") or die("Problem selecting database");
$query = "SELECT * FROM dedicated order by asset";
$result = mysql_query($query) or die ("Query failed");
$numofrows = mysql_num_rows($result);
echo "<TABLE BORDER=\"0\" table width=\"100%\">\n";
echo "<TR bgcolor=\"#cccccc\"><TD font colour=\"red\"><b>Asset</b></TD><TD><b>Title</b></TD><TD><b>Customer</b></TD><TD><b>Type</b></TD><TD><b>IP address</b></TD><TD><b>Reconciled</b></TD><TD><b>Edit</b></TD></TR>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from our result set
if($i % 2) {
echo "<TR bgcolor=\"#f5f7fb\">\n";
}
else {
echo "<TR bgcolor=\"#e6e6fb\">\n";
}
echo "<TD><font color=\"red\"><b><a href='viewall.php?varl=".$row['asset']."'>".$row['asset']."</a></b></font></TD><TD><font size=\"2\">".$row['title']."</TD><TD><font size=\"2\">".$row['customer']."</TD><TD><font size=\"2\">".$row['type']."</TD><TD><font size=\"2\">".$row['IP']."</TD><TD><font size=\"2\">".$row['recon']."</TD><TD><font color=\"red\"><a href='sysdocupdate.php?varl=".$row['asset']."'>Edit</a></font></TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";