Posted by bschultz (bschultz), 1 May 2003I'm trying to modify my sql db's since I had to move to a new ISP, and am no longer using my own server, and I'm having a problem writing to the db.
Here's the error message I'm getting:
1044: Access denied for user: '@localhost' to database 'bschultz_bgolf'
Here's the section of code I'm using:
ANy ideas what I'm doing wrong...the only thing I thought I had to change was the table name, to add the 'bschultz_" to it, which my new host requires...but it doesn't appear to me by the " '@localhost' that there is a username being used.
Posted by admin (Graham Ellis), 1 May 2003It looks like you have a permissions problem with the database - you're logging in OK but aren't able to use bschultz_golf. First test to confirm this is the case - replace your call to mysql_db_query with a call to mysql_select_db followed by a call to mysql_query, and check that the error now occurs in the mysql_select_db. By the way - mysql_db_query has been deprecated since 4.0.6, so the change should be left in
If it does turn out that the error is in the selection of the database, have a careful look at the ISP's documentation or contant them and ask; if they allow ANY database starting with your account name, it may well be that they have to create it themselves for you, or they have a special script to do so and to add access permissions for you to that new database.
Posted by bschultz (bschultz), 1 May 2003I replaced "mysql_db_query with mysql_select_db and got this error message:
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/bschultz/public_html/warriors/sports/bgolf/results/secure/dates/game1.php on line 18
As for the db starting with a user name, I've created the db with their cpanel script (the only way to create a db) and it automatically puts the username in front of it...there's no way around that.
On a side note, I've dumped the db's from my server to their server, and the script that calls the db info in the php pages are working fine...it's just the script to write the info to the db that isn't working right.
Posted by admin (Graham Ellis), 1 May 2003What are the parameter(s) that you're passing to mysql_select_db? It doesn't like the second one. which should be the variable returned by the mysql_connect - i.e. $db in this instance. You aren't passing the query in as the second parameter by any chance are you??
Posted by bschultz (bschultz), 2 May 2003I just re-did the entire script and it works now...thanks Graham.
For those of you wondering, here's the new script:
Thanks, again, Graham. You are a life-saver.
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho