php - How To Fetch 26 Rows of MySQL Data, But Display It Only First 25 -


i have simple task using php dealing pagination. idea simple, want mysql_fetch_array of sql query :

select name, email, cellphone users username = '$username' limit $x, 26; 

if query has 26 rows, means have show 'next page' button. but, want show user first 25 rows of it.

the 26th row indicator whether 'next page' button should shown or not.

currently, i'm using while display rows, how 'stop' while after 25 times loop?

while($rowsql = mysql_fetch_array($sql)) { echo "bla-bla-blah"; } 

this should trick:

$count = 1;  while($rowsql = mysql_fetch_array($sql)) {     if ($count == 25) {         last;     }      echo "bla-bla-blah";     $count++; } 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -