Re: [PHP4BETA] A (Hopefully) simple question *gulp*

From: Date: Fri, 28 Apr 2000 03:02:01 +0000
Subject: Re: [PHP4BETA] A (Hopefully) simple question *gulp*
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-14127@lists.php.net to get a copy of this message
WHOO HOO! got it. =) That code now looks like this " 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 bgcolor=\"#0099fa\">\n"; echo "<td valign=\"center\">ID</td><td align=\"center\" valign=\"center\">Dept</td><td>Category</td><td>Sub-Category</td><td>Descrip tion</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"; $bar = 0; while ($row = mysql_fetch_row($result)){ if ($bar % 2 == 0){ $bcolor="00AAAA"; } else { $bcolor="00ff00"; } echo "<tr bgcolor=\"#$bcolor\">"; // 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>"; $bar++; } " My style's a bit different from yours, David, but it seems to achieve the required result. Are there any disadvantages to doing it my way? It's just the way I write code. thanks again for all your time and help! Go aussie go! Cheers, Bradley ----- Original Message ----- From: David Robley <huntsman@www.nisu.flinders.edu.au> To: <mccroreyb@linux.com> Cc: <php4beta@lists.php.net> Sent: Friday, April 28, 2000 12:31 PM Subject: Re: [PHP4BETA] A (Hopefully) simple question *gulp* > On 28 Apr, Bradley wrote: > > Also, while I'm getting the gist of what you're saying, at the risk of > > sounding like an idiot I'd appreciate a little clarification on the > > following line: > > > >> display. Then, on each row, test the counter value mod 2. If the result > > > > "mod 2"? As in multiplied by 2? If so, I don't understand how a certain > > number would return 0. I think if you explain this bit to me I've already > > got the rest mapped out in my head. > > > > Cheers, > > > > Bradley > > Sorry, that's a bit shorthand. I mean the modulus, which is the > leftover, or remainder after you divide the counter by two (counter > modulus 2). In this case, the leftover can only be 0 or 1. And before > you ask, the modulus operator is % > > > Cheers > -- > David Robley | WEBMASTER & Mail List Admin > RESEARCH CENTRE FOR INJURY STUDIES | > http://www.nisu.flinders.edu.au/ > AusEinet | > http://auseinet.flinders.edu.au/ > Flinders University, ADELAIDE, SOUTH AUSTRALIA > > > -- > PHP 4.0 Beta Mailing List <http://www.php.net/version4/> > To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net > For additional commands, e-mail: php4beta-help@lists.php.net > To contact the list administrators, e-mail: php4beta-admin@lists.php.net >

« previous php.version4 (#14127) next »