Jump to content

Mysql need help starting off


riley200007

Recommended Posts

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 "<b><center>Database Output</center></b><br><br>";

 

$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 "<b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>";

 

$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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.