Page 1 of 1

mysqli_connect problem....

Posted: Thu Nov 10, 2005 7:36 am
by go4relax
hi folks.

i am a bloody php beginner and have some troubles.

when i trie to put my mysqli_connect into a separate function
ie. function db_connect() - i am not able to parse the ressource.

for example:

function db_connect()
{
$dbc = mysqli_connect("localhost", "user", "password", "db_name");
return $dbc;
}

$db_conn = db_connect();

is there any possibility?

thx, dieter

Posted: Thu Nov 10, 2005 7:54 am
by shiznatix
first i must ask you to use php code tags around your code. 2nd, how do you know its not being passed back? try to

Code: Select all

var_dump($db_conn)
3rd, why do you need to do that in the first place?

Posted: Thu Nov 10, 2005 8:08 am
by go4relax
ok, problem fixed, it works properly, had some config stuff wrong.

thanks a lot, dieter