- Connecting to a mysql server, it's the most of time installed in the same server where php is, so we uselocalhost as address of mysql server.mysql_connect("localhost", "username", "password") or die(mysql_error());
echo "Connected to MySQL Server";
Some times, when you are running a server in your own computer and not a hosting service provider's, you can connect with just indicating username "root" with no password, and some times is no need to enter an username. It's all depend on your current mysql configuration. - After you are connected to a mysql server, you need then to connect to a mysql database:mysql_select_db("database-name") or die(mysql_error());
echo "Connected to Mysql Database";
1 comments
Connect to Mysql Database
Connecting to the mysql database is done in two steps:
Subscribe to:
Posts (Atom)
Search With Google
Categories
- 1-General (3)
- 2-Getting started (4)
- 3-Strings (10)
- 4-Server config (1)
- 5-Best scripts (7)
- email (4)
- files (6)
- Forms (3)
- If statements (3)
- Loop statements (2)
- Mysql (2)
- Server variables (3)
- Sessions (1)
- Tutorials-planet.com (1)
- web hosting (1)
- You need a programmer ? (1)