Jump to content

PHP and MYSQL table formatting


pancgom

Recommended Posts

Hi Guys,

 

This is probably the most silliest of questions,  i am still learning php and mysql :-| .

 

I have this code below which brings up data from the database and displays it, what i want to do is to give the table headers a bgcolor how do i insert it, i get a parse error when i try to introduce a bgcolor..

 

Can anyone help.

 

<table border="1" bordercolor="black" cellpadding="2" cellspacing="0" width="550">

 

{php}

 

 

$db_username=;

$db_password=;

$db_name=;

 

mysql_connect($db_connect,$db_username,$db_password);

mysql_select_db($db_name);

$record_set=mysql_query("SELECT * FROM dDdDdD");

 

for($c=0; $c<mysql_num_fields($record_set);$c++){

 

 

print "<th>".mysql_field_name($record_set,$c)."</th>";

 

}

 

 

while($record=mysql_fetch_row($record_set)){

print "<tr>";

 

for($c=0; $c<mysql_num_fields($record_set);$c++){

print "<td>".$record[$c]."</td>";

 

}

print "</tr>";

}

 

 

 

{/php}

</table>

 

 

Link to comment
https://forums.phpfreaks.com/topic/89507-php-and-mysql-table-formatting/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.