Re: function return

From: Date: Fri, 06 Apr 2001 16:04:30 +0000
Subject: Re: function return
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-47456@lists.php.net to get a copy of this message
should work(works for me).probly something simple. <?php function conn(){ $db = mysql_pconnect("localhost", "" ,""); mysql_select_db("database",$db); return $db; } $db = conn(); $result= mysql_query("select * from table",$db); while($myrow=MySQL_fetch_array($result)) { $thing=$myrow["item"]; echo "$thing <br> "; } ?> ----- Original Message ----- From: Kurth Bemis <kurth@usaexpress.net> To: <php-general@lists.php.net> Sent: Friday, April 06, 2001 4:10 PM Subject: [PHP] function return > > i'm trying to make all my include files into functions for > manageability. I have one function that i'd like to get to work.....heres > teh code.. > > <?php > $db = mysql_pconnect("localhost", "user" ,"pass"); > mysql_select_db("database",$db); > ?> > > i had it in a function and had the function return $db.....but didn't > work.....any ideas? > > ~kurth > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#47456) next »