From: Clive Bruton [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 10:24 PM
Joakim, thanks, that sorted it. Just one note, numrows in
the sql query
should be num_rows? That's how I got it to work anyway.
Yes, that's totally correct. Just a typo.
Joakim
--
PHP Database Mailing
From: Clive Bruton [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 15, 2002 5:01 PM
How do I get both the number of rows found (5,000) and get a
subset of
the records (ie 0-9, 10-19, 20-29...) so that a user can
browse through
the records rather than getting 5,000 at a time (but still
[EMAIL PROTECTED] wrote at 16/07/02 09:44
$result = mysql_query(SELECT COUNT(*) as numrows FROM
table,$db);
$row = mysql_fetch_array($result);
$num_rows = $row['num_rows'];
Joakim, thanks, that sorted it. Just one note, numrows in the sql query
should be num_rows?
-Original Message-
From: Clive Bruton [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 14, 2002 2:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select a subset?
I'm just starting to play with PHP and MySQL, kind of getting my head
around it, but one thing I'm not getting (right) is delivery
Adam Alkins wrote at 15/07/02 04:06
mysql_num_rows just counts the amount of rows in a query, so if you only
selected 10 rows, it will return 10.
If you want to count all the rows in the table, its best to use the COUNT()
function
SELECT COUNT(*) FROM table
In my example, I've selected all
ie start at record 10 and show the next 10. But this delivers back 10
as the $num_rows variable, when I want the total number of rows.
I don't really have to complete two querys to get the appropriate values
do I?
mysql_num_rows just counts the amount of rows in a query, so if you only