rubyarat2010 Posted July 9, 2012 Share Posted July 9, 2012 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']; } Quote Link to comment Share on other sites More sharing options...
Barand Posted July 9, 2012 Share Posted July 9, 2012 every time you call $row = mysql_fetch_assoc($result) it fetches the next row. Quote Link to comment Share on other sites More sharing options...
rubyarat2010 Posted July 9, 2012 Author Share Posted July 9, 2012 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. Quote Link to comment Share on other sites More sharing options...
rubyarat2010 Posted July 9, 2012 Author Share Posted July 9, 2012 Wait never mind figured it out thanks man!! Quote Link to comment Share on other sites More sharing options...
hakimserwa Posted July 10, 2012 Share Posted July 10, 2012 what did you actually wanted? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.