How can we connect to a MySQL database from a PHP script?

It is for static page, dynamic page, website, SEO, performance and other web development discussion
ramverma
Posts: 435
Joined: Sat Aug 23, 2014 5:34 pm
Contact:

How can we connect to a MySQL database from a PHP script?

Postby ramverma » Mon Oct 19, 2015 6:11 am

How can we connect to a MySQL database from a PHP script?


jeff2345
Posts: 49
Joined: Tue May 05, 2015 7:09 pm
Contact:

Re: How can we connect to a MySQL database from a PHP script?

Postby jeff2345 » Tue Oct 20, 2015 6:39 am

To be able to connect to a MySQL database, we must use mysql_connect() function as follows:

PHP

<!--?php $database = mysql_connect("HOST", "USER_NAME", "PASSWORD"); mysql_select_db("DATABASE_NAME",$database); ?-->


Return to “PHP, HTML, MYSQL and Web Hosting”

Who is online

Users browsing this forum: No registered users and 2 guests