Forum Moderators: open
I was trying to figure out what should I do with these information listed below.
Should I create a table of database? If so, how should I do that? I am totally lost and need some help from you guys. :(
<?php
@require (dirname(__FILE__) . '/split-settings.php');
$con = mysql_connect($settings['db_host'], $settings['db_username'], $settings['db_password']);
mysql_select_db($settings['db_name']);
?>
What you have there (I believe) is a CONSTANT, __FILE__, defined in a configuration somewhere, or **possibly** __FILE__ is used a a "marker" to swap out whatever value is requesting the page containing this code. That is, if echoed, you might get
/server/path/to/split-settings.php
What split-settings.php does, apparently, is build an array called "settings" which if echoed might look something like this:
db_host => 'mysql.example.com',
db_name => name of the database to use
db_username => 'database user name',
db_password => 'database password for the above user'
Then it selects the database for use in these programs.
mysql_select_db($settings['db_name']);
Overall, in combination with the configuration file, this snippet is used to connect to a mysql database for whatever programs it's included in, log in this user, and select the database to use. That's what it does, now what is the question or problem? :-)
Thanks for the prompt reply, and you're right, my question was missing! LOL
Actually I have this file software that I wanted to put into my own hosting account. I have uploaded it into my server. However, when I tried to access into the URL where I put the file on, it asked for my username and password. I don't know where is the installation guide, but I figured out it's because I have not yet set up a database for this software.
I am a dead man when it comes to database. I have no idea on where to start configuring...
Start with this:
I have this file software that I wanted to put into my own hosting account.
A little more detail: name of software, who it's made by, version if possible . . . odd you don't have manual access.
I have uploaded it into my server. However, when I tried to access into the URL where I put the file on, it asked for my username and password.
As in brought you to a page for U and P? Or did it ask for a database as well? Most online packages have a setup step. They will generally require you enter the name of the database, the database user, and database password. They generally can automate it from there.
The way you'd do this is
- Log in to your control panel for your hosting account
- Look for databases icons or links.
- Create new database, name it.
- Create new database user, at which time you will be prompted to choose a password for the database user.
This will be the info you would enter, if we're talking about the same thing.