我正在尝试编写一个mysql查询,这样我就可以检索表的前10行,并在同一查询中获得总行计数。FROM myTable LIMIT 10; // Get First 10 RowsSELECT COUNT(*) as cnt FROM myTable // Total Row CountSELECT * FROM myTable
然后使用count()获取总行数,使用array_slice获取前1
我有两个表messages和message_archives,两个表列都是相同的。if(mysql_num_rows($privateMsg)){
while($getPrivateMsg=mysql_fetch_array($privateMsg)){mysql_query("INSERT INTO message_archives SET user_id='