|
[php]Database connexion function
|
|
08-28-2009, 09:47 AM
Post: #1
|
|||
|
|||
|
[php]Database connexion function
Hello!!
in this tuto I'm gonna explain how to make connection to your database using PHP 1-connexion script to start open your text editor copy and past this code: Code: <?$hostname = "localhost"; --->leave "localhost" or put your local ip 192.168.x.x if you're using your computer as a host $database = "database_name";--->enter the name of db you are going to use $username = "your_username";--->enter your username (root is the default username of mysql" $password = "your_password";--->enter your mysql password (leave it blank if you didn't edit it before) the second part of the code Code: $connection = mysql_connect($hostname, $username, $password) or die ("Unable to connect to the DB Server!");the third part Code: mysql_select_db($database) or die ("Can't select database!");it will select the dabatase. Note!!: you can use this code also for MSSQL server by replacing "mysql" with "mssql" 2-the include form after pasting the code into your text editor save it as con.php now if you wanna use this code for a php page,all you have to do is to add this code at the begining of the page Code: <?php |
|||
|
08-28-2009, 01:24 PM
Post: #2
|
|||
|
|||
|
RE: [php]Database connexion function
this might come in-handy someday (for me)^^
|
|||
|
09-12-2009, 07:33 AM
Post: #3
|
|||
|
|||
|
RE: [php]Database connexion function
Hi,
Mr. sasuke Good work keep tech it... |
|||
|
10-17-2009, 11:32 PM
Post: #4
|
|||
|
|||
|
RE: [php]Database connexion function
Thank you.
Keep on working!
|
|||
|
11-26-2009, 07:46 PM
Post: #5
|
|||
|
|||
|
RE: [php]Database connexion function
thanks for this
![]() Selling many, many steams. PM me. |
|||
|
12-20-2009, 02:25 AM
Post: #6
|
|||
|
|||
|
RE: [php]Database connexion function
this is great
|
|||
|
01-02-2010, 04:23 PM
Post: #7
|
|||
|
|||
|
RE: [php]Database connexion function
i dont get it o.0
|
|||
|
03-01-2012, 02:48 AM
Post: #8
|
|||
|
|||
|
RE: [php]Database connexion function
Life
--- By Allan Houston Life can be good, Life can be bad, Life is mostly cheerful, But sometimes sad. Life can be dreams, Life can be great thoughts; Life can mean a person, Sitting in court. Life can be dirty, Life can even be painful; But life is what you make it, So try to make it beautiful. Dream --- By Allan Houston Hold fast to dreams, For if dreams die life is a broken-winged bird That cannot fly. Hold fast to dreams, For when dreams go life is a barren field Forzen with snow. Flower Girl DressesEmpire Wedding DressesNew Style Wedding DressesColumn Wedding Dresses |
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)











![[Image: 2ugh0gp.png]](http://i44.tinypic.com/2ugh0gp.png)