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; } Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/ Share on other sites More sharing options...
AndyB Posted July 15, 2007 Share Posted July 15, 2007 No. server is undefined. Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/#findComment-299053 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. Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/#findComment-299058 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? Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/#findComment-299059 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 Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/#findComment-299061 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 Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/#findComment-299062 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. Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/#findComment-299063 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! Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/#findComment-299064 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 Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/#findComment-299065 Share on other sites More sharing options...
trq Posted July 15, 2007 Share Posted July 15, 2007 Show us how you call this function. Link to comment https://forums.phpfreaks.com/topic/60118-does-this-look-right/#findComment-299066 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.