RE: [PHP] run query

2002-12-10 Thread Jon Haworth
Hi Diana,

 After I run a query lik this,
 $db-query($sql);
 
 what is the quickest way to find out how many 
 records result? 

Look into mysql_num_rows (or the equivalent if you're not using MySQL)

Cheers
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] run query

2002-12-10 Thread @ Edwin
Or,

Jon Haworth [EMAIL PROTECTED] wrote:

 Hi Diana,
 
  After I run a query lik this,
  $db-query($sql);
  
  what is the quickest way to find out how many 
  records result? 
 
 Look into mysql_num_rows (or the equivalent if you're not using MySQL)

... you can even do it faster by using a

  select count(*) as something from some_table

More info (found in the manual):

  http://www.faqts.com/knowledge_base/view.phtml/aid/114/fid/12

HTH,

- E

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] run query

2002-12-10 Thread Rich Gray
Er... but the original poster wanted a count of rows returned by a
particular query... your method just returns the number of rows in the
table...

Rich

-Original Message-
From: @ Edwin [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 17:21
To: Jon Haworth; 'Diana Castillo'
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] run query


Or,

Jon Haworth [EMAIL PROTECTED] wrote:

 Hi Diana,

  After I run a query lik this,
  $db-query($sql);
 
  what is the quickest way to find out how many
  records result?

 Look into mysql_num_rows (or the equivalent if you're not using MySQL)

... you can even do it faster by using a

  select count(*) as something from some_table

More info (found in the manual):

  http://www.faqts.com/knowledge_base/view.phtml/aid/114/fid/12

HTH,

- E



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] run query

2002-12-10 Thread @ Edwin
Oops, ok, I misread the original question :)

Rich Gray [EMAIL PROTECTED] wrote:
 Er... but the original poster wanted a count of rows returned by a
 particular query... your method just returns the number of rows in the
 table...

Anyway, you're right. If you already have a result then use
mysql_num_rows().

- E

...[snip]...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php