Re: DB query returning wierd results

From: Date: Thu, 08 Aug 2002 18:14:40 +0000
Subject: Re: DB query returning wierd results
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-111699@lists.php.net to get a copy of this message
Is it actually skipping the first row, or is the first row showing up later and you don't notice it? The reason I'm asking is because you don't have a sort in your query statement (i.e. "SELECT * FROM SlideShow ORDER BY something"). Without the sorting, your first slide might be 5th or Nth depending upon where the database inserted it. hope this helps, Hugh ----- Original Message ----- From: "Brian V Bonini" <b-bonini@cox.net> To: "PHP Lists" <php-general@lists.php.net> Sent: Thursday, August 08, 2002 9:56 AM Subject: [PHP] DB query returning wierd results > Can anyone see a reason why the following would skip the first row of the > DB? > > <?php > $sql = "SELECT * FROM SlideShow"; > $result = mysql_query_check($sql); > $content = mysql_fetch_object($result); > $i=0; > while($row = mysql_fetch_object($result)) { > $img = $row->image_name; > $size = getimagesize("thumbnails/" . $img); > $popupSize = getimagesize("images/" . $img); > $popupWidth = (50+($popupSize[0])); > $popupHeight = (250+($popupSize[1])); > if (($i % 4) == 0) echo "<tr align=\"center\">\n"; > echo <<<ENDJS > <td> > <a href="#" > onclick="popup('./?id=$row->id','ig','width=$popupWidth,height=$popupHeight, > toolbar=no,scrollbars=yes,resizable=yes,location=no');"> > <img src="/ss/thumbnails/$img" $size[3] alt="click to enlarge" > /></a><br > />$popupSize[0] x $popupSize[1] > </td> > ENDJS; > echo "\n"; > $i++; > if (($i % 4) == 0) echo "</tr>\n"; > } > ?> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#111699) next »