Jump to content

Formatting PHP Output


MikeX

Recommended Posts

Hey all

 

 

I've been trying to format my PHP output on my script. So far I can do three things... Bold Italic Underline using b i u but thats it.. I have no clue how to use color or font or anything.

 

Any ideas? It would be ideal to be able to have no border.. which I know how to do.. and have alternating font/text backing color for each row.

 

Here's my script:

<?php
  include('dbconnect.php');
?><style type="text/css">
<!--
body {

}
-->
</style>
...

<?php
// Get all the data from the "Groups" table
$result = mysql_query("SELECT * FROM Groups") 
or die(mysql_error());  

echo "<table border='1'>";
echo "<tr> <th><b>University</b></th> <th>Group</th> <th>State</th> <th>Zip Code</th> <th>Website</th> <th>Email</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>"; 
echo $row['University_Name'];
echo "</td><td>"; 
echo $row['Group_Name'];
echo "</td><td>"; 
echo $row['State'];
echo "</td><td>"; 
echo $row['Zipcode'];
echo "</td><td>"; 
echo $row['Website'];
echo "</td><td>"; 
echo $row['Email'];
        echo "</td></tr>";
} 

echo "</table>";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.