dachshund Posted May 21, 2013 Share Posted May 21, 2013 Hi, I have the following code but I want to skip the very first result (or row) as I already have that echoed in a different format above. $sql = "SELECT * FROM content WHERE `live` LIKE '0' AND `date` >= SUBDATE(CURRENT_DATE, 1) ORDER BY `views` DESC LIMIT 40"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ Thanks Quote Link to comment https://forums.phpfreaks.com/topic/278247-skip-first-result-of-array/ Share on other sites More sharing options...
Solution Barand Posted May 21, 2013 Solution Share Posted May 21, 2013 $sql = "SELECT * FROM content WHERE `live` LIKE '0' AND `date` >= SUBDATE(CURRENT_DATE, 1) ORDER BY `views` DESC LIMIT 40"; $result=mysql_query($sql); $rows = mysql_fetch_array($result); // echo in format A while($rows=mysql_fetch_array($result)){ // echo in format B } Quote Link to comment https://forums.phpfreaks.com/topic/278247-skip-first-result-of-array/#findComment-1431406 Share on other sites More sharing options...
requinix Posted May 21, 2013 Share Posted May 21, 2013 If you already got the data earlier then why do you need another query? Can't you run just this query once, get the first row, output it the special way, and output the rest normally? Quote Link to comment https://forums.phpfreaks.com/topic/278247-skip-first-result-of-array/#findComment-1431417 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.