Re: error on count()

From: Date: Wed, 08 Sep 2004 05:15:54 +0000
Subject: Re: error on count()
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-36100@lists.php.net to get a copy of this message
> > 1. I tired to get the array like this: > > $una = $check["uname"]; > > function orderquantity ($una) { > > $pss = mysql_query("SELECT OID FROM orders WHERE > una = '".trim($una)."'") or die (mysql_error("Query > error on Order search")); > > while($pisao=mysql_fetch_array($pss)) { > > return count($pisao); > > } > > } > > $okuan = orderquantity(); > > first of all you should pass a variable to the function. Second :: function will just return one in any condition because $pisao is the array of return fields in the particular row. you should use mysql_num_rows($pss). no need of mysql_fetch_array() just return mysql_num_rows{$pss) after executing query. Third , I think it is best to use sensible variable like $query, $result, $row etc., well its depends on you. zareef ahmed ===== Homepage :: http://www.zasaifi.com _______________________________ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush

« previous php.db (#36100) next »