I'm really new to php programming and have a question. I've created the following .php file that queries a mysql database returning three variables; Manufacturer, Model, and link. When creating the table inside php, is there a way to control table and cell attributes such as alignment (table align="center") or cell size?
I have included the code below for your review.
<?
$NumberLines=trim($NumberLines);
$GuestServiceButtons=trim($GuestServiceButtons);
$Speakerphone=trim($Speakerphone);
$CordlessPhone=trim($CordlessPhone);
$CallerId=trim($CallerId);
$db = mysql_pconnect('localhost', '', '')
or die("Could not connect to database.");
mysql_select_db("tprphones",$db)
or die("Cannot select database");
{
$query = "SELECT phones.Manufacturer, phones.Model, phones.Link
FROM phones
WHERE ((phones.NumberLines = $NumberLines)AND(phones.GuestServiceButtons = $GuestServiceButtons)
AND(phones.Speakerphone = $Speakerphone) AND (phones.CallerId = $CallerId))"
or die("unable to query the database");
$result = mysql_query($query)
or die("This ain't working");
$column_count = mysql_num_fields($result);
print("<TABLE BORDER=0 >\n");
while ($row = mysql_fetch_row($result))
{
print("<TR ALIGN=LEFT VALIGN=TOP>");
for ($column_num = 0;
$column_num < $column_count;
$column_num++)
print("<TD>$row[$column_num]</TD>\n");
print("</TR>\n");
}
print("</TABLE>\n");
}
?>
I would prefer to dump the data into an html form, however, I don't have a known number of results returning from the query.
Any suggestions would be greatly appreciated.
Karen Rosencrance
krosencrance@thenittanygroup.com