prcollin Posted July 15, 2007 Share Posted July 15, 2007 <?php $dbsettings = array( 'servername' => "localhost", 'username' => "pr******n", 'password' => "******7", 'dbname' => "pr******mers", 'tablename' => "sign_up"); function connect($server,$user,$pass,$dbname) { $dbconn = mysql_connect($server, $user, $pass) or die(mysql_error()); $select = mysql_select_db($dbname, $dbconn) or die(mysql_error()); return $dbconn; } Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 15, 2007 Share Posted July 15, 2007 No. server is undefined. Quote Link to comment Share on other sites More sharing options...
trq Posted July 15, 2007 Share Posted July 15, 2007 Does this look right Depends how your calling the function. Quote Link to comment Share on other sites More sharing options...
prcollin Posted July 15, 2007 Author Share Posted July 15, 2007 No. server is undefined. how do i define it? Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 15, 2007 Share Posted July 15, 2007 how do i define it? Take a closer look at your array .... servername not server Quote Link to comment Share on other sites More sharing options...
prcollin Posted July 15, 2007 Author Share Posted July 15, 2007 how do i define it? Take a closer look at your array .... servername not server so should i change the others to match also or are those alright Quote Link to comment Share on other sites More sharing options...
benjaminbeazy Posted July 15, 2007 Share Posted July 15, 2007 it's ok. andy overlooked the fact that during the function definition, passed variables can be renamed whatever as long as they are referenced within the function by said name. he saw a mismatch between that and your servername variable in the array. Quote Link to comment Share on other sites More sharing options...
ss32 Posted July 15, 2007 Share Posted July 15, 2007 why do you create that large array if you arent going to use it? nothing looks wrong with the function itself, just make sure you implement the array! Quote Link to comment Share on other sites More sharing options...
prcollin Posted July 15, 2007 Author Share Posted July 15, 2007 it's ok. andy overlooked the fact that during the function definition, passed variables can be renamed whatever as long as they are referenced within the function by said name. he saw a mismatch between that and your servername variable in the array. so what is wrong then cause i can connect to my database but nothing posts when i submit my form into the database. I get no errors on submit etiher the form just resets Quote Link to comment Share on other sites More sharing options...
trq Posted July 15, 2007 Share Posted July 15, 2007 Show us how you call this function. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.