help needed with database

dipeshsilwal1

New Member
Messages
184
Reaction score
0
Points
0
<?php

//connection info
$login = "your login info";
$password = "your password info";
$database = "your database"; <-------------what does this mean?

//connection
$conn = mysql_connect("localhost","$login","$password");
$db = mysql_select_db("$database"); <------------what does this mean?

//misc info
$ip = $_SERVER['REMOTE_ADDR']; <------------what does this mean?
$time = time(); <------------what does it mean time?

Please help.

i am trying to solve this for long time.
 

bigguy

Retired
Messages
10,984
Reaction score
10
Points
38
Are trying to get this going for a regular phpbb forum ?
 

Tyler

Retired Staff
Messages
8,564
Reaction score
0
Points
0
Well i know for sure the first one
$database = "your database"; <-------------what does this mean?
Is your username for cpanel_the name of the database here is an example: "ts2e_smf" just change "ts2e" to your subdomain and "smf" to the name of the database. Im not sure the second or third questions, try just leaving them like that and just changing the databas. If that dont work post back here I'll help you out :)
 

bigguy

Retired
Messages
10,984
Reaction score
10
Points
38
It might help us out a bit more if you told us what forum software you are trying to use to connect to the database with.
 

dipeshsilwal1

New Member
Messages
184
Reaction score
0
Points
0
well i don't know if i have to use a software to create a database?

if there is any software to create database then please reply back or contact me.
 

stuffradio

New Member
Messages
38
Reaction score
0
Points
0
If your using x10 for your host, you can go to cPanel and create the database within cPanel. Then just write the name of the database within the quotes.
 

bigguy

Retired
Messages
10,984
Reaction score
10
Points
38
dipeshsilwal1 said:
well i don't know if i have to use a software to create a database?

if there is any software to create database then please reply back or contact me.

Ok I guess a better question is, what will you be using the database for ? Is it for a forum or are you just trying to create a database for some other purpose ?
 

prateekkalra

New Member
Messages
94
Reaction score
0
Points
0
Ill explain u more dep Go to http://www.yourdomain.com/cpanel and put your username and password . Then there will be a option My sql click on it then search on the page for "create new data base" these will create a data base . Now if u chose abcd for ur data base name Then.

$ $db = "username_abcd";
These step for second line

And same on the line

$database = "your database";

"$ip = $_SERVER['REMOTE_ADDR']; <------------what does this mean?"

These can only tell by ur host


" $time = time(); "

These line tell you that in how much time script should reboat it it is in second or min i dont know that

For an exp

$time = time(10);
 

The_Magistrate

New Member
Messages
1,118
Reaction score
0
Points
0
To fillin the form that you have with a new database, follow these steps:

1. Goto www.yourdomain.com/cPanel and click on the "MySQL Databases" icon.

2. Enter a name into the "Db: " field and click "Add Db". This will create a new database. For example, if you enter "TestDb" into the field, then your new database will be called "<CPANEL_LOGIN>_TestDB" where <CPANEL_LOGIN> is the account name you use to login to cPanel.

3. Now you have to create a new account for accessing the database. Under the "Users:" section enter a username and password for a NEW account. Do not enter the login/password for your cPanel account. For example, I'll create a new account with the username "TestDbLogin" and password "TestDbPass". The new account will be created with a username of "<CPANEL_LOGIN>_TestDbLogin" where <CPANEL_LOGIN> is the account name you use to login to cPanel.

4. You have now created a new database with a corresponding account. Note, this database is empty; it contains no tables and no data.

5. Now you can fill in the script you have with the information about the database and username you just created:

PHP:
<?php

//connection info
$login = "<CPANEL_LOGIN>_TestDbLogin";  /* The login name you created to access the database in step 3. */
$password = "TestDbPass";  /* The password you created for the account above. */
$database = "<CPANEL_LOGIN>_TestDB";  /* This is the name of the database your connecting to, which you created in step 2. */

/* ----- YOU DO NOT HAVE TO EDIT ANYTHING BELOW THIS LINE ----- */
//connection
$conn = mysql_connect("localhost","$login","$password");
$db = mysql_select_db("$database");  /* This is the php function to tell the server to start using the new database you created. */

//misc info
$ip = $_SERVER['REMOTE_ADDR']; /* This gets the client IP to be recorded in the database. */
$time = time(); /* time(); is the PHP function to get the current time.  The time will be recorded in the database for record keeping.  This is UNIX time which is stored in seconds.*/
Now, mind you, you have not created any tables for your database and your database will not contain any data. You will have to create tables in your database before you can start storing/retrieving data with it.
 
Top