Page 1 of 1

Display results skip first line - mySQL

Posted: Thu Aug 12, 2004 1:13 pm
by DanielleDee
feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hi!

When I display the entire results from a database table (mySQL), for some reason the 1st line is left out.  My code is:

Code: Select all

<?php 

include_once ("dbc.php"); 
$sql=@mysql_query ("SELECT * FROM `my_desc`");
$row=mysql_fetch_array($sql);
$num_rows=mysql_num_rows($sql);
  if ($num_rows < 0) 
  {  
  echo "No Results Available";
	} 
while ($display = mysql_fetch_array($sql)) {
$id= $display["id"];
$title= $display["title"];
$status= $display["status"]; 

echo($id);
echo($title);
echo($status);
}
?>
My primary key is set as auto_increment on id.

If there is 3 rows:
1, Title 1, sold
2, Title 2, sold
3, Title 3, bid

then only the rows for Title 2 and Title 3 will display.

Any ideas?

Thanks!


feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Thu Aug 12, 2004 1:35 pm
by Buddha443556
Remove this line:

Code: Select all

$row=mysql_fetch_array($sql);
Doesn't seem to have a purpose anyway.