Jump to content
xisto Community
Sign in to follow this  
cool1405241471

How Do I Connect Php To A Database ?

Recommended Posts

You'll need to have access to a MySQL database server, then you need to open the link to it and execute a query.

It's all very nicely described here:

PHP MySQL Manual

 

Good luck.

Share this post


Link to post
Share on other sites

Connecting to a database is done simply with mysql_connect function. You create a handle, just like for accessing a file. $handle = mysql_connect(...Mysql_connect needs the address for the database server (here in asta just use localhost), database username and a password.The connection to the database is closed with function mysql_close which takes your handle as a parameter. mysql_close($handle)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.