Web programming problem ! PHP and MySQL !!!?
-
I have installed WAMP on my windows XP, and I'm using apache. when I'm running this code I'm getting error: Code: <html> <body> <?php $con = mysql_connect("localhost","yahooanswers"… if (!$con) { die('Could not connect: ' . mysql_error()); } ?> </body> </html> Error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'yahooanswers'@'localhost' (using password: NO) in C:\wamp\www\bb.php on line 4 Could not connect: Access denied for user 'yahooanswers'@'localhost' (using password: NO) I have made the database by phpmyadmin as you can see in this pic: http://wayiran.fileplace.biz/phpmyadmin.gif and my wamp is runing apache and mysql as you can see: http://wayiran.fileplace.biz/mysql.gif http://wayiran.fileplace.biz/apache.gif but i get this error.... This is my first time that i want use mysql with php.... Help me please...
-
Answer:
you are not giving a password when you try to connect. Try somethign like this $host="localhost"; $username="yahooanswers"; $password=""; $link = mysql_connect($host $username $password) or die("Unable to connect to database"); echo "connection successfull"; *NOTE* put a comma in between $host $username and $password, whenever I try to post this answer with commas it just puts "..." after the first comma. *Edit*Im sorry I didnt notice the "yaho..." I assume you have the password in there. If so then ignore my answer. hope that helps
Author at Yahoo! Answers Visit the source
Other answers
use phpmyadmin to create a user called 'yahooanswers' and give this user permissions to the 'yahooanswers' database
irishtek
You have not provided a password for the connection. The mysql_connect function takes 3 arguments; hostname, username, password in that order. Therefore, you should have something like this in order for this to work: $con = mysql_connect("localhost","yahooanswers"… ... etc That should just about do it.
Beatmaster
Related Q & A:
- How To Build Business Directory Using Php Mysql?Best solution by Stack Overflow
- How to create a Restful web service in .Net Using MySQL?Best solution by stackoverflow.com
- How to write a query for PHP and MySQL?Best solution by Stack Overflow
- How can I make a dynamic web page in PHP?Best solution by Yahoo! Answers
- How to create a table in PHP with MySQL?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.