Jarod Posted November 4, 2009 Share Posted November 4, 2009 I've been trying to figure out how wordpress has done this via a form when installing wordpress, I don't know if i'm close to solving it but I think I've started myself off well prepared for this happening: <?php public class dbComponent { private var $dbhost; private var $dbname; private var $dbuser; private var $dbpass; function __construct($tdbhost,$tdbname,$tdbuser,$tdbpass) { $this->setDBHost($tdbhost); $this->setDBName($tdbname); $this->setDBUser($tdbuser); $this->setDBPass($tdbpass); $connect = mysql_connect($this->getDBHost(),$this->getDBUser(),$this->getDBPass()) or die(mysql_error()); mysql_select_db($this->getDBName(),$connect); } public setDBName($name) { // Set database name? $this->dbname = $name; } public getDBName() { // Get database name then return $this->dbname; } public setDBHost($host) { // Set database host? $this->dbhost = $host; } public getDBHost() { // Get database host then return $this->dbhost; } public setDBUser($username) { // Set database username? $this->dbuser = $username; } public getDBUser() { // Get database username then return $this->dbuser; } public setDBPass($password) { // Set database password? $this->dbpass = $password; } public getDBPass() { // Get database password then return $this->dbpass; } } ?> This is pretty much a start for me I believe, where the user will be able to setup the a newer connection to a database for future reference. I've not figured out how I will input the values so that they are then transferred to output for installation and/or connecting to the newly database, then carried on for database queries; though, any help on this please? Quote Link to comment https://forums.phpfreaks.com/topic/180344-solved-how-does-wordpress-automatically-setup-the-database-connection-and-installation/ Share on other sites More sharing options...
.josh Posted November 4, 2009 Share Posted November 4, 2009 last time I checked, wordpress does not set db info in the install. You have to set that up yourself and provide wordpress with the info... Quote Link to comment https://forums.phpfreaks.com/topic/180344-solved-how-does-wordpress-automatically-setup-the-database-connection-and-installation/#findComment-951352 Share on other sites More sharing options...
Jarod Posted November 4, 2009 Author Share Posted November 4, 2009 That's what im talking about though, I've let a form for the user to provide the details, I just need to know how the transaction is done once they have submitted their details . Quote Link to comment https://forums.phpfreaks.com/topic/180344-solved-how-does-wordpress-automatically-setup-the-database-connection-and-installation/#findComment-951354 Share on other sites More sharing options...
.josh Posted November 4, 2009 Share Posted November 4, 2009 Okay so I'm not sure what you're asking. Are you wanting to know how your script would save the info and then use it to connect to the db later? You would have your install script generate a config script/file with the info in it, saved to wherever (outside of the public dir). Then your script would have the config file included when it needs it. Quote Link to comment https://forums.phpfreaks.com/topic/180344-solved-how-does-wordpress-automatically-setup-the-database-connection-and-installation/#findComment-951360 Share on other sites More sharing options...
Jarod Posted November 4, 2009 Author Share Posted November 4, 2009 Yes! That's it, why didn't I think of that before :'(, thanks man. Quote Link to comment https://forums.phpfreaks.com/topic/180344-solved-how-does-wordpress-automatically-setup-the-database-connection-and-installation/#findComment-951365 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.