Re: How many rows in a table
- From: bill <nobody@xxxxxxxxxxx>
- Date: Sun, 31 Dec 2006 10:32:02 -0500
Andy Hassall wrote:
On Sat, 30 Dec 2006 17:04:58 -0500, bill <nobody@xxxxxxxxxxx> wrote:
I am sure there must be an easy way to determine the number of rows in a table, but I can't find it.
I appreciate the courtesy and patience ng members have shown this mysql novice.
select count(*) from your_table
$total_rows = mysql_query ("SELECT COUNT(*) FROM Kennel");
gives me a resource, not the count.
Fine, so I use:
$total_rows = mysql_query ("SELECT COUNT(*) FROM Kennel");
echo "Rows in table: " . mysql_num_rows ($total_rows) . "<br />";
but that returns 1, and there are 4 rows in the table.
However,
$sql = "Select id, kennel_name, location, real_names from Kennel
ORDER BY REPLACE(kennel_name,'The ','') LIMIT 100";
$result = mysql_query($sql, $connection) or die(mysql_error());
echo "Rows in table-2: " . mysql_num_rows ($result) . "<br />";
does give the correct answer.
what am I doing wrong with the first query ?
.
- Follow-Ups:
- Re: How many rows in a table
- From: Andy Hassall
- Re: How many rows in a table
- From: GT
- Re: How many rows in a table
- Prev by Date: Re: ordering mysql request by part of a key
- Next by Date: Re: How to import large MySQL data dump using PHP?
- Previous by thread: Re: ordering mysql request by part of a key
- Next by thread: Re: How many rows in a table
- Index(es):
Relevant Pages
|