PDA

View Full Version : Setting Up connect.php


vinyl-junkie
08-14-2004, 12:31 PM
The following is some guidance on just how to fill in the parameters for your phpdig database connection script, connect.php. You'll note that there are five parameters to be defined:define('PHPDIG_DB_PREFIX','<dbprefix>');
define('PHPDIG_DB_HOST','<host>');
define('PHPDIG_DB_USER','<user>');
define('PHPDIG_DB_PASS','<pass>');
define('PHPDIG_DB_NAME','<database>');
The username and password (PHPDIG_DB_USER and PHPDIG_DB_PASS, respectively) are under your control. Pick whatever you want for these values, but make sure they agree with the username and password that were setup when you defined your phpdig database.

For the remaining parameters, the easiest way to tell what they should be is to look at what shows up on phpMyAdmin, on your web host's control panel. Here's one example:
Database prefixname_phpdigdb running on localhost

There are three parts to this message:

1) The database has a prefix called prefixname
2) phpdigdb is the database name
3) The MySQL database is running on localhost, meaning that it is running on the same server as your website

Hence, your connect.php file would be set like so for the following variables:

define('PHPDIG_DB_PREFIX','prefixname');
define('PHPDIG_DB_HOST','localhost');
define('PHPDIG_DB_NAME','phpdigdb');

Here is another example:

Database phpdigdb running on sql02.server25.host.com
The above message tells you:
1) There is no database prefix
2) phpdigdb is the database name
3) The MySQL database is running on a server called:
sql02.server25.host.com

Hence, your connect.php file would be set like so for the following variables:

define('PHPDIG_DB_PREFIX','');
define('PHPDIG_DB_HOST','sql02.server25.host.com');
define('PHPDIG_DB_NAME','phpdigdb');


Questions, comments and suggestions are welcome. :)

Charter
08-15-2004, 03:39 PM
Hi. One thing to add is that if you use the install.php file, and you don't have permission to create database such as with certain hosting accounts, then you should run install.php and select create tables instead, and then you shouldn't have to mess with _connect.php or connect.php, assuming you use the correct database info when you run the install.php file.