|
|
|
The following shows a table drawn from a databse (MySql in this case) using php to give red fonts for negative number and blue for positive numbers. The rows are also in alternate colors. You need t ofill in your own data and parameters for the database, of course.
<table border=0 bgcolor=white width="502" cellpadding="0"
cellspacing="0">
<tr><td>
<table border="0" cellpadding="2" cellspacing="1" width="100%">
<tr bgcolor="336699">
<td align=middle id="header">a</td>
<td align=middle id="header">b</td>
<td align=middle id="header">c</td>
<td align=middle id="header">d</td>
<td align=middle id="header">e</td>
</tr>
<?php
mysql_connect(localhost,user,password);
$database="your_database";
@mysql_select_db("$database") or die( "Unable to select database");
$table="your_table";
$query="select * from $table
where $table.data1=something AND $table.data2 >0 order by this_order";
$result=mysql_query($query);
mysql_close();
/*Display Results*/
$num=mysql_num_rows($result);
$i=0;
while ($i < $num) {
$a=mysql_result($result,$i,"a");
$b=mysql_result($result,$i,"b");
$c=mysql_result($result,$i,"c");
$d=mysql_result($result,$i,"d");
$e=mysql_result($result,$i,"e");
//Alternate row colors in our table
print ($i % 2) ? "<tr bgcolor=\"CCCCCC\">" : "<tr
bgcolor=\"BEEFFF\">";
print "<td align=right>$a</td>";
print "<td align=right>$b</td>";
print "<td align=right>$c</td>";
print "<td align=right>$d</td>";
print "<td align=right><span style=\"color:";
if ($d > 0){
print "blue";
} else {
print "red";
}
print ";\">$e</span></td>";
++$i;
}
?>
</table>
|
|
| This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server. Categories : Databases, MySQL, Complete Programs, PHP, Databases | | | Paginator - a class that can help you to split MySQL database query result sets to pages. Categories : MySQL, Databases, HTML, PHP | | | bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager Categories : MySQL, PHP, MySQL, Complete Programs, Databases | | | Newbie Notes #10 - Generating drop downs Categories : PHP, MySQL, HTML, Beginner Guides, Databases | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | Cut your MySQL Connections to 1 line of code Categories : PHP, Beginner Guides, Databases, MySQL | | | phpAds, a complete banner and ad management system with detailled tracking and stats. Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases | | | Point and Click Interface ala MS Access for creating SQL statements. Categories : MySQL, Complete Programs, General SQL, PHP, Databases | | | Message of the Day - Random Message (Needs MySQL!) Categories : Databases, HTML and PHP, PHP, MySQL | | | Alternating background color for HTML table rows Categories : PHP, Databases, MySQL, HTML and PHP | | | Authorize Me! An authentication script. Categories : MySQL, Databases, Authentication, PHP | | | A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL | | | Tropicalm Genetree Family (MySQL based family tree) Categories : PHP, Interfaces, Databases, MySQL, Complete Programs | | | mysql_escape_string Categories : PHP, MySQL, Databases, Strings | | | Automatically printing the contents of an sql table in MySQL. Categories : MySQL, PHP, HTML and PHP, Databases | |
|
|
|