Kurrel Posted July 4, 2007 Share Posted July 4, 2007 Hi everyone, I'm using WAMP5 (1.6.6) for the first time, trying to do some small-time home development. This comes with Apache, MySQL and PHP5 all bundled together. I already develop for a PHP company, but everything's already set up in that arena and my problem is the 'getting everything going' phase. I've set up a database called 'testdb' with the SQLiteManager that comes bundled with the WAMP and written a query to fetch the data from a table 'testtable'. my query is '$query = "SELECT * FROM testtable WHERE 1=1";' and '$result = mysql_query($query) or die(mysql_error());'. On execution, I get 'Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\FirstRun\index.php on line 9 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\FirstRun\index.php on line 9 Access denied for user 'ODBC'@'localhost' (using password: NO)' I suspect it's a database selection problem and am going through notes to try remedy this myself... but if someone can answer in the time it takes me to fix it, I'd appreciate it! ~K Quote Link to comment https://forums.phpfreaks.com/topic/58371-solved-wamp-database-selection/ Share on other sites More sharing options...
Illusion Posted July 4, 2007 Share Posted July 4, 2007 post your code. First u need to set a password for root account from command prompt :\>mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd'); mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd'); if u don't want to encrypt ur password, remove PASSWORD() function SET PASSWORD FOR 'root'@'localhost' = 'newpasswd'; and then code should be something like this $link=mysql_connect('localhost', 'root', 'password') die(mysql_error()); $query = "SELECT * FROM testtable WHERE 1=1"; $result=mysql_db_query('testdb', $query, $link ) or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/58371-solved-wamp-database-selection/#findComment-289459 Share on other sites More sharing options...
Kurrel Posted July 4, 2007 Author Share Posted July 4, 2007 Thanks a bunch!! That worked a treat, and has resolved my issues. ~K PS : If you still want, I can post the code? Quote Link to comment https://forums.phpfreaks.com/topic/58371-solved-wamp-database-selection/#findComment-289504 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.