access denied

This is a discussion on "access denied" within the PHP Forum section. This forum, and the thread "access denied are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 2nd, 2005, 23:41
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
access denied

im just starting to get to grips with mysql using php.

i set up my first database not long ago, and i tried to connect to it using the following:

Code: Select all
<?php
// Connecting, selecting database
$dbh=mysql_connect ("localhost", "tuggersc_gavtest", "<tuggers_gavtest>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("tuggersc_gavssqltest"); 
// Performing SQL query
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
   echo "\t<tr>\n";
   foreach ($line as $col_value) {
       echo "\t\t<td>$col_value</td>\n";
   }
   echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
?>
following this tutorial from php.net http://www.php.net/manual/en/ref.mysql.php(bout 30% down.)
but it says when i try to view the file

Warning: mysql_connect(): Access denied for user: 'tuggersc_gavtest@localhost' (Using password: YES) in /home/tuggersc/public_html/fantasy-league-test/mysql_test/test.php on line 11
I cannot connect to the database because: Access denied for user: 'tuggersc_gavtest@localhost' (Using password: YES)

the location is http://www.tuggers.co.uk/fantasy-lea..._test/test.php

cheers all
Reply With Quote

  #2 (permalink)  
Old Aug 3rd, 2005, 09:10
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
This really does look like you've got something wrong.

Double check the server name, database name, username and password.
I'm fairly sure something isnt quiet right there looking at the error message
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #3 (permalink)  
Old Aug 3rd, 2005, 14:14
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
the connection string was copied from cpanel, so i would guess that it was correct....

i havnt changed anything on it. except putting the password in. what could it be...?
Reply With Quote
  #4 (permalink)  
Old Aug 3rd, 2005, 21:04
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
That exact same code works fine here.

You must be using either the incorrect servername, username, password or perhaps you're trying to access a table that you don't have rights to access. Check all these things again.
Reply With Quote
  #5 (permalink)  
Old Aug 3rd, 2005, 21:06
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
i dont think ive set up a table yet, would that be why? i just set up the database stright from cpanel u see. so i dont know if there would be a table already made......
Reply With Quote
  #6 (permalink)  
Old Aug 4th, 2005, 10:57
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
If the table didn't exist, you would get a different error with details of the table that could not be accessed.

There must be a problem with either the hostname, database name or password.
Reply With Quote
  #7 (permalink)  
Old Aug 4th, 2005, 18:45
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
ive checked the username and password, and they are fine. so it must be sothing to do with the host name. i have it at local host, which was the example i used. but what is an example of a hostname. its on a web host at zmb.co.uk

im stumped lol
Reply With Quote
  #8 (permalink)  
Old Aug 4th, 2005, 23:08
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
It's usually localhost, but some hosts choose to have a seperate mysql server... they should tell you this!
Reply With Quote
  #9 (permalink)  
Old Aug 4th, 2005, 23:13
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
ive flagged a post on the admin support section. ill see what they have to say and get back to u
Reply With Quote
  #10 (permalink)  
Old Aug 11th, 2005, 03:16
Tim356's Avatar
Reputable Member
Join Date: Nov 2003
Location: Australia
Age: 25
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Tim356
Any luck?
Reply With Quote
  #11 (permalink)  
Old Aug 19th, 2005, 11:01
Highly Reputable Member
Join Date: May 2005
Location: U.K
Age: 21
Posts: 739
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbramz
have i eck

i wsubmitted a ticket and then somthing went wrong with the ticket section of the site. theres no a box that says Unauthorized Version Installed and a box to enter a lisence code.

so ive been waiting for them to fix that.

but now ive had enough!
lol
Reply With Quote
Reply

Tags
access, denied

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] HELP!! Frame source &quot;access denied&quot; kevinkan JavaScript Forum 8 Oct 3rd, 2007 08:28
ASP Multi users Access to Microsoft Access ish Classic ASP 0 Apr 26th, 2007 20:05
Access Denied Problem EdwardA Databases 3 Dec 27th, 2006 22:51
Permission Denied '800a0046' - but why? simoncpage Classic ASP 3 Jan 30th, 2006 15:13
Image copy denied LadyT Graphics and 3D 7 May 7th, 2005 10:26


All times are GMT. The time now is 11:23.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43