Jump to content

setting mysql connection in function..


Fluf

Recommended Posts

Do i miss something??

function mysql_conn($host,$username,$password,$db)

  {

  mysql_connect($host,$username,$password);

  mysql_select_db($db);

    }

mysql_conn("localhost","user","password","dbname");

And when i try to use mysql_query then mysql_error() keeps telling me no database selected, i even made a whole new function for mysql_select_db, didn't work..i keep asking myself, why???

Link to comment
https://forums.phpfreaks.com/topic/125822-setting-mysql-connection-in-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.