Jump to content

Display SQL Query results but skip first row


slj90
Go to solution Solved by ginerjm,

Recommended Posts

I want to display data from a MySQL Table but I want to skip the first row of data.

My code so far displays all the rows:

$result=mysqli_query($con,"SELECT filename FROM images WHERE item_id = '$id'");

if (mysqli_num_rows($result) > 0) {
   
    while($row = mysqli_fetch_assoc($result)) {
		
        echo "<img src='../pictures/items/" . $row[filename] . "' height='200'><br><br>";
}
} else {
    echo "You haven't added any items yet.";
}

What do I need to add to skip the first row?

 

Thanks

Edited by slj90
Link to comment
Share on other sites

without an ORDER BY term in your sql statement, there is NO guarantee that any particular row of matching data is going to always be the first row.

 

what characteristic does your data have that identifies what order you want the rows from the query to be in and what identifying characteristic or value is there that you can use to not include the one particular row in the result set?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.