Connect MySQL with PHP:

We know that our PHP and MySQL is on same localhost server XAMPP. So we can connect them easily.

Syntax:

            mysql_connect(“servername”,”username”,”password”) or die (“Error”);

Example:

 Note:

In above example we use server name as “localhost” because we are using XAMPP and the username is “root” for localhost and the password is blank “” for localhost.

Leave a Reply

Your email address will not be published. Required fields are marked *