Imam mysql bazu, u kojoj imam pored ostalih npr. polje "karakter"...
u koje samo se unosi "ozbiljan" i "neozbiljan" npr....
kada izlistam podatke iz pomenute tabele
hteo bih, naravno ako to moze da sve gde je "neozbiljan" u polju "karakter"
da oboji taj red u neku odredjenu boju...
p.s. postojeca tabela mi vec ima boje za parne i neparne redove
ukoliko to smeta da bi ovo funkcionisalo, sklonicu.....
trazio sam po net-u, slaba vajda sem ovog koda sa linka: http://www.phpfreaks.com/forums/index.php?topic=158877
<?php
error_reporting(7);
$db = mysql_connect("localhost","......",".....") or die("Problem connecting");
mysql_select_db(".....") or die("Problem selecting database");
$query = "SELECT * FROM rules ORDER BY username";
$result = mysql_query($query) or die ("Query failed");
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = mysql_num_rows($result);
echo "<TABLE BORDER=\"1\">\n";
echo "<TR bgcolor=\"lightblue\"><TD>UserID</TD><TD>UserName</TD><TD>Agreed?</TD><TD>Date Agreed</TD></TR>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from our result set
if($i % 2) { //this means if there is a remainder
echo "<TR bgcolor=\"yellow\">\n";
} else { //if there isn't a remainder we will do the else
echo "<TR bgcolor=\"white\">\n";
}
echo "<TD>".$row['userid']."</TD><TD>".$row['username']."</TD><TD>".$row['diduseragree']."</TD><TD>".$row['dateagreed']."</TD>\n";
echo "</TR>\n";
}
//now let's close the table and be done with it
echo "</TABLE>\n";
?>
ukoliko je neko voljan da mi pomogne
HVALA UNAPRED