huh I thought I tried that befoer and it didnt work but this time it worked good, thanks everyone.
Also whats the difference between $globals['$variable'] and just global -Lee "Maxim Maletsky" <[EMAIL PROTECTED]> wrote in message news:20021110082455.7C29.MAXIM@;php.net... > > you need to return $db: > > function db_conn($host,$user,$pass,$dab) > { > $db = mysql_connect("$host", "$user","$pass" > mysql_select_db("$dab",$db); > return $db; > } > > and then use $db = db_conn(,,,); > > or make it global: > > > function db_conn($host,$user,$pass,$dab) > { > blobal $db; > $db = mysql_connect("$host", "$user","$pass" > mysql_select_db("$dab",$db); > } > > -- > Maxim Maletsky > [EMAIL PROTECTED] > > > On Sun, 10 Nov 2002 02:16:14 -0500 "conbud" <[EMAIL PROTECTED]> wrote: > > > also I have the function wrong in my original question I have it as > > function db_conn($host,$user,$pass,$dab) > > { > > $db = mysql_connect("$host", "$user","$pass" > > mysql_select_db("$dab",$db); > > } > > > > and not > > function db_conn($host,$user,$pass,$dab) > > { > > $db = mysql_connect("$host", "$user","$pass")mysql_select_db("$dab",$db); > > } > > > > > > "Conbud" <[EMAIL PROTECTED]> wrote in message > > news:20021110065837.99825.qmail@;pb1.pair.com... > > > Hey > > > Im trying to create a fucntion in an include file > > > function db_conn($host,$user,$pass,$dab) > > > { > > > $db = mysql_connect("$host", "$user","$pass")mysql_select_db("$dab",$db); > > > } > > > .... > > > .... > > > In the page ide use: > > > require('func.inc.php'); > > > db_conn("$host","$user","$pass","$dab"); > > > $result = mysql_query("select * FROM $page",$db); > > > $myrow = mysql_fetch_array($result); > > > > > > echo $myrow['general_info']; > > > > > > ... > > > ... > > > however when I use the db_conn on the webpage I just get a mysql error > > > saying not a valid resource, so how do I get the db_conn to actually > > return > > > the data, ive tried using > > > > > > function db_conn($host,$user,$pass,$db) > > > { > > > $db = mysql_connect("$host", "$user","$pass")mysql_select_db("$db",$db); > > > > > > return $db > > > } > > > > > > and various other thing but still nothing, I have to actually put the echo > > > statements in the function too to get it to work properlly, any ideas? > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php