young
Новичок
php mySQL api: FOUND_ROWS
А проще никак?
Может для этого уже какую-нить функцию типа mysql_insert_id придумали?!
А проще никак?
Может для этого уже какую-нить функцию типа mysql_insert_id придумали?!
MySQL 4.0 supports a fabulous new feature that allows you to get the number of rows that would have been returned if the query did not have a LIMIT clause. To use it, you need to add SQL_CALC_FOUND_ROWS to the query, e.g.
$sql = "Select SQL_CALC_FOUND_ROWS * from table where state='CA' limit 50";
$result = mysql_query($sql);
$sql = "Select FOUND_ROWS()";
$count_result = mysql_query($sql);
You now have the total number of rows in table that match the criteria. This is great for knowing the total number of records when browsing through a list.