php4-beta | 200004
Date: 04/27/00
- Next message: David Robley: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Previous message: Evan Klinger: "Re: [PHP4BETA] CyberSource"
- Next in thread: David Robley: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Reply: David Robley: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Maybe reply: php4 <email protected>: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Maybe reply: Bradley: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi guys, I sent this bit of code here a while back and everyone was REALLY helpful. I'm hoping to get the same sort of results this time (fingers crossed).
I use this snippet to display the rows of a user-configured select in a table format.
"
elseif ($disp)
{
if ($subcats == "All") {
$result = mysql_query("SELECT $sources FROM $catty",$db);
} else {
$result = mysql_query("SELECT $sources FROM $catty WHERE SubCategory = '$subcats' order by $sorter",$db);
}
echo ">> $subcats $catty Query sorted by $sorter<br>";
echo "<table cellspacing=\"2\" class=\"narea\">";
echo "<tr>\n";
echo "<td valign=\"center\">ID</td><td align=\"center\" valign=\"center\">Dept</td><td>Category</td><td>Sub-Category</td><td>Description</td><td>Make</td><td>Model</td><td>Model Number</td><td>Serial Number</td><td>Date Acq'd</td><td>Vendor</td>\n";
echo "</tr>\n";
while ($row = mysql_fetch_row($result)){
echo "<tr bgcolor=\"#00AAAA\">";
// The next bit turns the id number into a link to edit the properties //
// of the line item. It uses the javascript from way back in the beginning //
// of the script to popup a little editing window //
for ($p = 0;$p < count($row);$p++) {
if ($p == 0) {
echo "<td><font size=\"2\" face=\"arial, helvetica\">";
echo "<a href='javascript:openPopWin(\".//update/update.php?id=$row[$p]&catty=$catty\", 400, 400, \"\", 1, 1)'>$row[$p]</a>";
} else {
echo "<td><font size=\"2\" face=\"arial, helvetica\"> $row[$p]</font></td>";
}
}
echo "</tr>";
}
"
and it works BRILLIANTLY. Here comes the question. I've seen a lot of tables built in php with alternating row colors. Most notably phpmyadmin and freshmeat.net. What I mean is, the first row is a certain color, then the second row is a second color, the third row goes back to the original color...and so on and so forth.
Is there a relatively simple way to do this? If I have to, I suppose I could try and dismantle the phpmyadmin code (wouldn't be the first time.. =) but I'd rather not as there are a lot of things there that I don't need.
Ideas anyone?
TIA,
Bradley
- Next message: David Robley: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Previous message: Evan Klinger: "Re: [PHP4BETA] CyberSource"
- Next in thread: David Robley: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Reply: David Robley: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Maybe reply: php4 <email protected>: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Maybe reply: Bradley: "Re: [PHP4BETA] A (Hopefully) simple question *gulp*"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

