mysql_connect
Posted by: trevshand (---.microsoft.com)
Date: March 04, 2009 10:11PM

I am trying to learn PHP and MySQL. I have built a form and want to get the contents of the form to post to a local MySQL database. To do this I need to include a mysql_connect command which is followed by my mysql server location, user name, password and database name. I created a new user using myphpadmin but I'm getting an error, I believe because I don;t have the location correct.

Can anyone help?

Trevor



Edited 1 time(s). Last edit at 03/05/2009 06:38PM by trevshand.

Options: ReplyQuote
Re: mysql_connect
Posted by: c2dan (---.sotn.cable.ntl.com)
Date: March 04, 2009 11:04PM

Example connection

$conn = mysql_connect('localhost', 'username', 'password')
mysql_select_db('database_name']);


If you cant connect with the user you created then ensure you have setup the correct privileges.

Options: ReplyQuote
Re: mysql_connect
Posted by: yfastud (Moderator)
Date: March 05, 2009 12:27AM


Options: ReplyQuote
Re: mysql_connect
Posted by: wasifhossain (---.btcl.net.bd)
Date: March 05, 2009 07:29AM

please,

i am also facing this same problem . the browser is warning that "access is denied for user@localhost".

then i tried to check mysql installation from command prompt, however it was saying that "couldn't connect to the localhost". i think there's any problem with the MySQL installlation.

if anybody knows, please reply.

thanks.

Options: ReplyQuote


Sorry, only registered users may post in this forum.