Re: Returning only a row count of 1?

From: Date: Fri, 05 Mar 2004 19:45:38 +0000
Subject: Re: Returning only a row count of 1?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-179593@lists.php.net to get a copy of this message
Hello Alex, Friday, March 5, 2004, 7:40:08 PM, you wrote: AH> I have 6 records in this table but using this code; AH> $querytotalcount = "SELECT COUNT(*) AH> FROM CF_Survey"; AH> $totalrows = mssql_num_rows($resulttotalcount); AH> I only return a count of 1. It will only return 1 row because that's all you've asked it to return - a count of the number of records. This is for MySQL but you'll get the idea: $sql = "SELECT COUNT(*) AS hits FROM CF_Survey"; $hits = mysql_result($result, 0, "hits"); Run your query directly in MSSQL and you'll see what gets returned. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html

« previous php.general (#179593) next »