hey guys
im trying to upload a database into company websites directory i have checked the server using phpinfo and php and mysql are both installed
all i have put up there is a small access database on there with one test record im trying to connect to the damn thing and read the record but all i get is my_sql cannot connect to database, there is no user name or password on the database so i have taken the two varibles away from the
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
this is the code i am using bar company details for obvious reasons
<?
$database="database.accdb";
mysql_connect(localhost);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<center>Database Output</center>
";
$i=0;
while ($i < $num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
echo "$first $last
Phone: $phone
Mobile: $mobile
Fax: $fax
E-mail: $email
Web: $web
--------------------------------------------------------------------------------
";
$i++;
}
?>
and this is what im getting
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO) in /usr/local/psa/home/vhosts/(company address)/httpdocs/test.php on line 11
Unable to select database
can any1 please help
cheers