Re: while loop with if statement - here's the code

From: Date: Mon, 20 Aug 2001 15:31:46 +0000
Subject: Re: while loop with if statement - here's the code
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-63525@lists.php.net to get a copy of this message
okay - read all the code now. this might be a better way: <?php $results = mysql_db_query("$db", "select * from $table where $query order by update_datetime desc limit $offset, 10"); $one = mysql_fetch_array($results); $numrows=mysql_num_rows($one); // get the number of results if ($numrows>0) { for ($x=0;$x<$numrows;$x++) { $id=$one["id"]; $title=$one["title"]; $description=$one["description"]; print " <TR><TD VALIGN=TOP><img src=/assets/images/bullet.gif width=10 height=8></TD><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2><A HREF=/view_top.php3?id=$id>$title</A><BR>$description</TD></TR>\n <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif width=10 height=6></TD></TR>\n "; } // end of for } else { print " <TR><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2>NO RESULTS</TD></TR>\n <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif width=10 height=6></TD></TR>\n "; } ?>

« previous php.general (#63525) next »