Jump to content

riley200007

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

riley200007's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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
  2. 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
×
×
  • 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.