Forum Moderators: coopster
Here is the output code:
$num_rows = mysql_num_rows($permit);
if ($num_rows == 0){
echo "<p>not allowed</p>";
echo "back ti <a href='index.php'>start<a/>";}
else{
if (isset($r_showcat)){
$showdoc = mysql_query("SELECT * FROM $prefix"."documents where catid=$r_doccat ");
while ( $rowshowdoc = mysql_fetch_array($showdoc) ) {
echo "<table width=100%><tr><td>";
echo("<b><span class=mini>Doc:</b> ".$rowshowdoc ["name"]."</td><td class=mini align='left'>Date: " . $rowshowdoc ["date"] . "</td><td><b><a target='_blanc' href='./docs/".$rowshowdoc ["name"]."'>show doc</a></b></td></tr>\n");
echo "<tr><td colspan='3'><i class=mini>".$rowshowdoc ["description"]."</i></td></tr>";
echo "</tr></table><br> \n";
} }
You may also want to give a search [google.com] a try to see what comes up.
Good luck! :)
At the beginning of your operation, set a variable like $togglecolor as 0. Use it to switch back and forth from each line.
$togglecolor == 0;
Then, inside your for or while loop, where you are defining your colors:
if ($togglecolor == 0) {
// color it one way
$togglecolor = 1;
} else {
// the other color
$togglecolor = 0;
}
Hope this helps.
</g>
Create 2 CSS classes called bg_0 and bg_1
.bg_1
{
background-color: #E3E3E3;
}
.bg_0
{
background-color: #FFFFFF;
}
Then in your table do this, include this in a while loop like so
<?php
while ($var = mysql_fetch_array(...))
{
$i = ($i + 1) % 2;
echo "<table border=\"0\" width=\"100%\" class=\"bg_$i\">";
echo "<tr>";
echo "<td>Hello</td>";
echo "</tr>";
}
?>
Remember too that if you are using this is multiple tables to reset the value of $i to 0 just do something like
$i = 0 you get the idea? my HTML etc might be a bit sloppy and stuff but im sure you can work it out so it works with your code.
HTH
Chris