Re: Functions - scope of returned result

From: Date: Thu, 14 Aug 2003 17:13:55 +0000
Subject: Re: Functions - scope of returned result
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-29895@lists.php.net to get a copy of this message
Dillon, John wrote:
One more bite on this code. function queries(){ //code...... $piv_result=mysql_db_query($db, $query, $connection) or die ("Query9 failed: $query"); return $piv_result; } function print(){ global $piv_result; $count_fields=mysql_num_fields($piv_result); //ERROR: //code........... } //MAIN queries(); print(); Should this work - $piv_result is being returned from one function and then being used in another function. Am I missing something?
Yes, you're returning the result set, but you're not assigning it anywhere. $rs = queries(); print($rs); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals – www.phparch.com

« previous php.db (#29895) next »