Jump to content

Get Next Row


rubyarat2010

Recommended Posts

Is there a way to get the next row? So il2 and title 2 would be the next row?

mysql_select_db("posts", $con);

$sql = "SELECT title, imagelink FROM posts1 ORDER BY id DESC LIMIT 6";
$result = mysql_query( $sql) or die( mysql_error() );


while($row = mysql_fetch_assoc($result))
{

#echo $row['imagelink'];
$title1 = $row['title'];
$il1 = $row['imagelink'];
$title2 = $row['title'];
$il2 = $row['imagelink'];
}

Link to comment
https://forums.phpfreaks.com/topic/265424-get-next-row/
Share on other sites

Ok.  If i do this the second one goes up one but the first assighn does not work.


$sql = "SELECT title, imagelink FROM posts1 ORDER BY id DESC LIMIT 6";
#$sql2 = "SELECT * FROM posts1 WHERE id='1';";
$result = mysql_query( $sql) or die( mysql_error() );

$title1 = $row['title'];
$il1 = $row['imagelink'];
$row = mysql_fetch_assoc($result);
$title2 = $row['title'];
$il2 = $row['imagelink'];

thanks for the quick responsce.

Link to comment
https://forums.phpfreaks.com/topic/265424-get-next-row/#findComment-1360273
Share on other sites

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.