Jump to content

Why is this code skipping the first record?


tyler_durden

Recommended Posts

I have three records in this table, yet the script below only displays two records, skipping the first item.  I have tried it in other fields also, and it is always skipping the first record?

$result = mysql_query("SELECT * FROM `content_type_ads`");

$row = mysql_fetch_array( $result );

while($row = mysql_fetch_array($result)){
echo $row['nid']. " - ". $row['field_item_id_value'];
echo "<br />";
}

Select only the data you need from the database in your query:

 

$result = mysql_query("SELECT field_item_id_value FROM `content_type_ads`");

 

(note: In your code, unless you've changed it since the OP, you're also using the nid column)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.