Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-19-2011, 09:22 AM   PM User | #1
daza93
New to the CF scene

 
Join Date: Nov 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
daza93 is an unknown quantity at this point
Change html table font style in php

I'm using the following code to display data from my database but how do i change the font size, type of the table cells?

Code:
//Retrive all the data from the table
$result = mysql_query("SELECT * FROM stats2") or die(mysql_error());  

echo "<table border='1' cellspacing='0' width='593'>";
echo "<tr> <th bgcolor='#BFBFBF' align='center'>Name</th> <th bgcolor='#BFBFBF' align='center'>Apps(Sub)</th> <th bgcolor='#BFBFBF' align='center'>Goals/CS</th> <th bgcolor='#BFBFBF' align='center'>Yellows</th> <th bgcolor='#BFBFBF' align='center'>Reds</th> <th bgcolor='#BFBFBF' align='center'>MOTM</th> </tr>";


// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {

// Print out the contents of each row into a table
echo "<tr><td align='center'>"; 
         echo $row['name'];
echo "</td><td align='center'>"; 
	echo $row['apps']; echo '('; echo $row['sub']; echo ')';
echo "</td><td align='center'>"; 
	echo $row['goals'];
echo "</td><td align='center'>"; 
        echo $row['yellows']";
echo "</td><td align='center'>"; 
         echo $row['reds'];
echo "</td><td align='center'>"; 
	echo $row['MOTM'];
echo "</td></tr>"; 
} 

echo "</table>";
daza93 is offline   Reply With Quote
Old 11-19-2011, 09:54 AM   PM User | #2
Adee
Regular Coder

 
Join Date: Jul 2010
Location: Oregon City
Posts: 280
Thanks: 5
Thanked 50 Times in 49 Posts
Adee can only hope to improve
with css.....

<style type="text/css">
td { your styles here.. }
tr { your styles here.. }
</style>

??
Adee is offline   Reply With Quote
Old 11-19-2011, 10:16 AM   PM User | #3
daza93
New to the CF scene

 
Join Date: Nov 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
daza93 is an unknown quantity at this point
Quote:
Originally Posted by Adee View Post
with css.....

<style type="text/css">
td { your styles here.. }
tr { your styles here.. }
</style>

??
Where would I place this code?

Tried a couple of times put doesn't seem to work
daza93 is offline   Reply With Quote
Old 11-19-2011, 10:31 AM   PM User | #4
Adee
Regular Coder

 
Join Date: Jul 2010
Location: Oregon City
Posts: 280
Thanks: 5
Thanked 50 Times in 49 Posts
Adee can only hope to improve
Quote:
Originally Posted by daza93 View Post
Where would I place this code?

Tried a couple of times put doesn't seem to work
PHP Code:
echo <<<CSS
<style type="text/css">
td { font-family: courier; color: red; }
</style>
CSS; 
Adee is offline   Reply With Quote
Old 11-19-2011, 01:25 PM   PM User | #5
myfayt
Senior Coder

 
Join Date: Apr 2010
Posts: 1,156
Thanks: 46
Thanked 95 Times in 94 Posts
myfayt can only hope to improve
Make a new file, put in the CSS coding such as Adee has shown below, and save with with a name like style.css

Code:
<style type="text/css">
td { font-family: courier; color: red; }
</style>
Then in the file where you want to use it, in the header put this.

Code:
<link rel="stylesheet" type="text/css" href="mystyle.css" />
change mystyle.css to the path and name of your file.
__________________
Been a sign maker for 5 years. My business:
American Made Signs
myfayt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:05 AM.


Advertisement
Log in to turn off these ads.