accessing mysql db with php issue

ok i have done this a hundred times but tonight can’t get it to work

here is the non-secure code for testing

[php]//Database Connect--------------------------
$link = mysql_connect(‘localhost’, ‘usernamegoeshere’, ‘pwdgoeshere’, ‘dbnamegoeshere’);
if (!$link)
{ die(‘Connect Error (’ . mysql_connect_errno() . ') ’ . mysql_connect_error()); }
echo 'Connected… ’ . mysql_get_host_info($link) . “\n”;

//this echoes that it is connected just fine…but then…

$db_selected = mysql_select_db(‘databasenamegoeshere’, $link);
if (!$db_selected) {
die ('Can’t use databasenamegoeshere : ’ . mysql_error());
}

//and it simply won’t do this query the error is denied because username is denied access
/
$query = "INSERT INTO tablenamehere (allthisstuff, etc)

[/php]

yes i have:

  1. connected to server just fine without query involved
  2. connected to server and printed out db list

but when i try to access this db for anything i am denied
checked and rechecked all usernames and pwds

any suggestions?
thanks

Strange, have you checked the users permissions? Can you run queries directly to sql (if you have a login on the server)?

i am a host so i have access but i don’t know how to verify
i did add some data to the table via mysql
i just can’t get this to work
thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service