Lee Hnetinka - How to connect MySQL database in PHP?

Started by leehnetinka, February 15, 2018, 06:14:39 AM

Previous topic - Next topic

leehnetinka

I am Lee Hnetinka, How to connect MySQL database in PHP?

Bigguy

You will have to give us a bit more of an idea about what you are trying to do before anyone can really help.

Doug Heffernan

Quote from: leehnetinka on February 15, 2018, 06:14:39 AM
I am Lee Hnetinka, How to connect MySQL database in PHP?

Hello,

You are not giving much details as to what you want to do. I am assuming that you want to connect to mysql outside Smf. In that case please try this code:

<?php

$servername 
"localhost";
$db_username "username";
$db_password "password";

$connection mysql_connect($servername$db_username$db_password);

if (!
$connection
{
    die(
'Connection error : ' mysql_error());
}
?>


And of course, you should fill in the correct database information for the variable values listed in my example. Hope it helps.

Advertisement: