WmZilla - Webmaster and Marketplace

The Next Generation Webmaster and Trade Forum

config.php

Intus

New member

0

0%

Status

Offline

Posts

34

Likes

0

Rep

0

Bits

180

3

Months of Service

0%
I am making a PHP website through localhost, but I want to connect my site to a database. The method I found didn't work, even after looking at the new PDOs. How can I resolve this issue?

$username = "root";
$password = "password";
$server = "localhost";
$database = "";
$connect = mysql_connect($server, $username, $password);
mysql_query("SET NAMES UTF8");

if(!$connect) {
echo "Connection Error: " . mysql_errno();
exit();
}

$db = mysql_select_db($database);

if(!$database) {
echo "Database Error: " . mysql_error();
echo "";
echo "You can edit the database connection details in the connect.php file";
exit();
}
 

249

6,622

6,642

Top