A
Anonymous
Guest
i already set the server and install MySQL. How do i know whether the connection is right or not? what command to use to check everything is right or not? thanks
SELECT 1 + 1 AS sum;
<?php
$localhost ="localhost";
$dbuser="your_db_name";
$dbpass= "your_db_pass";
$dbname = "your_db_name";
mysql_connect($localhost, $dbuser, $dbpass) or die
(mysql_error());
@mysql_select_db ("$dbname") or die(mysql_error());
?>
<?php
$result = mysql_query("SELECT 1 + 1 AS sum");
$row = mysql_fetch_assoc($result);
echo $row[sum];
?>
Like swirlee said, it seems you didn´t filled in the database name, username and password for $dbname and $dbuser and $dbpass!kiwi said:Warning: mysql_connect(): Access denied for user: 'your_db_name@localhost' (Using password: YES) in c:\inetpub\wwwroot\Untitled-1.php on line 15
Access denied for user: 'your_db_name@localhost' (Using password: YES)
<?
$dbuser="your database username here";
$dbpass= "your database password here";
$dbname = "your database name here";
?>
$localhost ="localhost";
$dbuser="root";
$dbpass= ""; // There´s no password
$dbname = "your_db_name"; // Your DB name here