jonsamwell Posted August 27, 2008 Share Posted August 27, 2008 Hi all, I am just learning php and have completed a tutorial inputing what the tutorial said but when i run the script i get the following errors. i am using MYSQL database on a localhost (my machine) and am positive i have the correct username and password for the server (wamp). i am running the script in 'www' directory as wamp instructs errors: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'jonsamwell'@'localhost' (using password: YES) in C:\wamp\www\test\phptestquery.php on line 3 Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\phptestquery.php on line 5 Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in C:\wamp\www\test\phptestquery.php on line 5 Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\test\phptestquery.php on line 9 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\test\phptestquery.php on line 9 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\test\phptestquery.php on line 17 Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\test\phptestquery.php on line 28 the code i have is as follows: - <?PHP //connection info $conn = mysql_connect("localhost", "jonsamwell", "password"); //msql select database method mysql_select_db("test1"); //define variables with $* $query_all = 'SELECT * FROM ss_users'; //variable to contain result data $results = mysql_query($query_all); //create xml to read into flash echo=println echo "<?xml version=\"1.0\?>\n"; //XML Root tag echo "<All Users>\n"; //creates an array and returns result to variable in while loop while ($results_array=mysql_fetch_assoc($results)) { echo "<item>" . $results_array["User_ID"] . "</item>\n"; echo "<item>" . $results_array["User_Login_Name"] . "</item>\n"; echo "<item>" . $results_array["P_word"] . "</item>\n"; echo "<item>" . $results_array["Email"] . "</item>\n"; } //close root tag echo "</All Users>\n"; //close connection to db mysql_close($conn); ?> any ideas would be great!! Thanks, Jon Link to comment https://forums.phpfreaks.com/topic/121618-php-script-returning-error/ Share on other sites More sharing options...
DarkWater Posted August 27, 2008 Share Posted August 27, 2008 The error clearly says that you couldn't log in. All those errors are because of that. Link to comment https://forums.phpfreaks.com/topic/121618-php-script-returning-error/#findComment-627339 Share on other sites More sharing options...
Mchl Posted August 27, 2008 Share Posted August 27, 2008 Check if user jonsamwell is allowed to connect from localhost (it's not obvious) Link to comment https://forums.phpfreaks.com/topic/121618-php-script-returning-error/#findComment-627340 Share on other sites More sharing options...
Cosizzle Posted August 28, 2008 Share Posted August 28, 2008 And if your password is indeed "password" you may want to change that Link to comment https://forums.phpfreaks.com/topic/121618-php-script-returning-error/#findComment-627385 Share on other sites More sharing options...
jonsamwell Posted August 28, 2008 Author Share Posted August 28, 2008 how would i check it the user is allowed to login from a local host?? i have mysqlphpadmin and wamp server. thanks Link to comment https://forums.phpfreaks.com/topic/121618-php-script-returning-error/#findComment-627623 Share on other sites More sharing options...
bluejay002 Posted August 28, 2008 Share Posted August 28, 2008 check for the users... i am not familiar with the wamp server though as i am using xampp but i dont use phpmyadmin for that. if you have phpmyadmin you can check that. anyway, by default, you have a user with username 'root' and no password. you can use this in 'localhost' or '127.0.0.1' connection. since you are on the learning process (as i suppose), you can use that but on real scenario you wouldn't do that. Link to comment https://forums.phpfreaks.com/topic/121618-php-script-returning-error/#findComment-627629 Share on other sites More sharing options...
JasonLewis Posted August 28, 2008 Share Posted August 28, 2008 To check for users I believe it's under Privileges in the first menu you see when you open phpMyAdmin. Down towards the bottom. Link to comment https://forums.phpfreaks.com/topic/121618-php-script-returning-error/#findComment-627632 Share on other sites More sharing options...
jonsamwell Posted August 28, 2008 Author Share Posted August 28, 2008 brilliant thanks guy works like a charm Link to comment https://forums.phpfreaks.com/topic/121618-php-script-returning-error/#findComment-627985 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.