php - Paginate issue with count in a query with group by -


ok use pagination code counts total pages, this

$query = "select count(*) num $tablename `ganador2` = '1'";     $total_pages = mysql_fetch_array(mysql_query($query));     $total_pages = $total_pages[num]; 

then call data query echo page contents.

// page data     $query1 = "select id,name,lastname,email,codigo, media, phone, pcode, birth $tablename  `ganador2` = '1' limit $start, $limit "; 

this last part working code, ok,

know im trying use querys, count how many times user has entered email.

$query = "select count(*) num,id,name,lastname,email,codigo, media, phone, pcode, birth usuarios group email";     $total_pages = mysql_fetch_array(mysql_query($query));     $total_pages = $total_pages[num]; 

and

// page data     $query1 = "select count(*) top,id,name,lastname,email,codigo, media, phone, pcode, birth usuarios group email order top desc limit $start, $limit"; 

the problem pagination, telling me query found (2 users) thats not true, query wrong.. how can calculate total pages in first query, second query working fine.

thanks

with group getting count per email. getting number of records have first email... think want.

select count(distinct email) num usuarios; 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -