try this: -js
<table border=1> <? $i = 0; while ( $myrow = mysql_fetch_array($result) ) { $c = ( ++$i % 2 ? 'yellow' : 'white' ); echo "<tr bgcolor=\"$c\">"; printf('<td><a href="%s?id=%s&delete=yes">Delete</a></td>', $PHP_SELF, $myrow['id'] ); $q = ceil( 4/(int)date('n', strtotime($mydata['date']) )); printf('<td><a href="%s?id=%s&submit=yes">%s</a></td><td>%s</td><td>%s</td></tr>', 'update-inv.php', $myrow['id'], $myrow['name'], $myrow['details'], $q); } ?> </table> Jim Hatridge wrote: > HI all, > > In the code below I'm trying to get the last column to show 1, 2, 3, or 4 > according to which quarter of the year it is. But all it shows in that column > is " Resource ID # X". The X starts with #3 and goes to 18. There are (at the > moment) 15 items in the table. Any ideas what's wrong? > > Thanks > > JIM > > ############################# > <?php > echo "<table border=1> \n"; > $i=1; > while ($myrow = mysql_fetch_array($result)) { > 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"; > } > $qdate=$myrow["date"]; > $sql = "select quarter($qdate)" or die("not work #3"); > $yyy = mysql_query ($sql) or die("not work #4"); > > printf("<td><a href=\"%s?id=%s&delete=yes\">Delete</a></td>", $PHP_SELF, > $myrow["id"]); > printf("<td><a href=\"%s?id=%s&submit=yes\">Update</td><td>%s</td><td> > %s</td><td> %s</td></a></tr>", > "update-inv.php", $myrow["id"], $myrow["name"], $myrow["details"], $yyy); > $i=$i+1; > } > echo "</table>\n"; > } > ?> > ############################# > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php