Women in Technology

Hear us Roar



Article:
  Using MySQL from PHP
Subject:   Results not displaying first record?
Date:   2005-12-01 02:57:31
From:   Electra
>sql query:


$result = mysql_query("SELECT * FROM `events`") or die(mysql_error());
while($row = mysql_fetch_array($result)) {
$ID = $row["ID"];
$Dt = $row["Dt"];
$Event = $row["Event"];


echo $Dt . "$nbsp;nbsp;" . $Event . "
";
}


>There are 3 records in the database, but only records from the 2nd row are displayed. Using mysql_fetch_row($result) displays nothing? I've also added LIMIT 0,30 to the query to try and force the first row, but with no luck.

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Results not displaying first record?
    2006-02-20 06:11:02  amjohnno [View]

    I had this same problem. The issue with mine was that I was using mysql_fetch_array() to verify that there was data in there before I used it again. The first time it was called used the first record, and so it was no longer visible when I ran the second call.