- eraniichanStraw Hat Pirate
- Posts : 43
Points : 98718
Coins : 6259
Join date : 2013-03-30
Warning Level :
Database connection in PHP
Mon Nov 25, 2013 8:53 am
First, we need to identify these 3 important details so we can connect in to our database.
You need to identify the connection address,the username and the password of the application of your database.(If you're not familiar with a database connection information, you can just search it in google)
So for example these are the details for your database connection, in my case I'm using xampp's sql database:
connection address: localhost or 127.0.0.1
username/login: root
password: (empty as default)
so these will be the code to connect to the database
You need to identify the connection address,the username and the password of the application of your database.(If you're not familiar with a database connection information, you can just search it in google)
So for example these are the details for your database connection, in my case I'm using xampp's sql database:
connection address: localhost or 127.0.0.1
username/login: root
password: (empty as default)
so these will be the code to connect to the database
- Code:
<?php
mysql_connect("localhost","root","");
mysql_select_db("database")or die("No database");
?>
Permissions in this forum:
You cannot reply to topics in this forum