mysqli_connect problem....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
go4relax
Forum Newbie
Posts: 2
Joined: Thu Nov 10, 2005 7:30 am

mysqli_connect problem....

Post 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
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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?
go4relax
Forum Newbie
Posts: 2
Joined: Thu Nov 10, 2005 7:30 am

Post by go4relax »

ok, problem fixed, it works properly, had some config stuff wrong.

thanks a lot, dieter
Post Reply