Re: Functions - scope of returned result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux