...

View Full Version : MySQL Info With Include PHP



Mujib
10-22-2009, 06:28 PM
Hello,

My problem is that i cant connect with MySQL.

I get This Error

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on '217.18.70.82' (4) in /home/assassin/domains/realdutchserver.nl/public_html/webformysql/bans.php on line 23
Could not connect to database

This is My Code


$db = mysql_connect('$host','$username','$password') or die(mysql_error()); // This connects to the MySQL server
mysql_select_db('$database', $db);

This is the Include i Use


<?php
$host = '217.18.70.82';
$username = 'server5646';
$password = 'password';
$database = 'server5646';
?>

Fumigator
10-22-2009, 06:41 PM
Your database or user is not configured correctly.

_Aerospace_Eng_
10-23-2009, 05:58 AM
Your code is wrong. You are using single quotes around your variables. If you want treated as variables then use double quotes or no quotes at all.

$db = mysql_connect($host,$username,$password) or die(mysql_error()); // This connects to the MySQL server
mysql_select_db($database, $db);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum