khan07 Posted February 3, 2007 Share Posted February 3, 2007 Hi guys I am a newbie to php. I wanna use myphpadmin with php. But i keep getting connection problems. I have attched what i have done. I would appriciate if someone can tell me what i am doing wrong and how to fix it. Thanks alot [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/ Share on other sites More sharing options...
Orio Posted February 3, 2007 Share Posted February 3, 2007 You haven't defined $car. Try this: <?php $dbuser="c0366683"; $dbpass="ld4413"; $dbname="db0468911"; //the name of the database $chandle = mysql_connect("c0366683@localhost", $dbuser, $dbpass) or die("Connection Failure to Database"); echo "Connected to database server<br>"; mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found." . $dbuser); echo "Database " . $database . " is selected"; mysql_close($chandle); ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176065 Share on other sites More sharing options...
khan07 Posted February 3, 2007 Author Share Posted February 3, 2007 Hi Orio I am still getting the connection problem. Is it right the way I have defined the table car? from the below code? <?php $dbuser="c0366683"; $dbpass="ld4413"; $dbname="db0468911"; //the name of the database $chandle = mysql_connect("c0366683@localhost", $dbuser, $dbpass) or die("Connection Failure to Database"); echo "Connected to database server<br>"; mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found." . $dbuser); echo "Database " . $car . " is selected"; mysql_close($chandle); ?> Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176350 Share on other sites More sharing options...
khan07 Posted February 3, 2007 Author Share Posted February 3, 2007 the error message i am gettin is Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'c0366683@localhost' (11004) in C:\wamp\www\can.php on line 6 Connection Failure to Database I changed it to just localhost' and i get the below message Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'c0366683'@'localhost' (using password: YES) in C:\wamp\www\can.php on line 6 Connection Failure to Database <?php $dbuser="c0366683"; $dbpass="ld4413"; $dbname="db0468911"; //the name of the database $chandle = mysql_connect("localhost", $dbuser, $dbpass) or die("Connection Failure to Database"); echo "Connected to database server<br>"; mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found." . $dbuser); echo "Database " . $car . " is selected"; mysql_close($chandle); ?> Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176412 Share on other sites More sharing options...
JasonLewis Posted February 3, 2007 Share Posted February 3, 2007 have you created the user and pass in phpmyadmin. if not go into phpmyadmin and on the main page look for a link named Privileges. Click that then look for another link called Add User. Add your username, password but dont add anything for host , then hit the check all button then submit. then try. thats assuming you havnt created the user. Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176418 Share on other sites More sharing options...
khan07 Posted February 4, 2007 Author Share Posted February 4, 2007 TO log into my phpadmin i have to type my user name and password. i can create, edit and do queries on myphpadmin Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176893 Share on other sites More sharing options...
khan07 Posted February 4, 2007 Author Share Posted February 4, 2007 Yeah I can do that. TO log into my phpadmin i have to type my user name and password. i can create, edit and do queries on myphpadmin I have attached how i log in you can check it let me know if its right or wrong :-\ Not sure what i am doing wrong. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176901 Share on other sites More sharing options...
JasonLewis Posted February 5, 2007 Share Posted February 5, 2007 i'm not sure if this applies to you, but when i login to my cpanel i must enter my user name. then i create a user for phpmyadmin and to access that user i have to type: cpanelusername_mysqlusername Same with the database. not sure if that applies. Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-177225 Share on other sites More sharing options...
mmarif4u Posted February 5, 2007 Share Posted February 5, 2007 1st of all just search ur username,password,hostname... for example ur username is 123456,pass is 007 and hostname almost i see is localhost... put these in ur conn variables... Like this $dbhost="localhost"; and then put it in the $chandle = mysql_connect($dbhost, $dbuser, $dbpass) or die("Connection Failure to Database"); echo "Connected to database server<br>"; try these may be this will help... Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-177234 Share on other sites More sharing options...
khan07 Posted February 5, 2007 Author Share Posted February 5, 2007 I can give you the website to see how i log in and my username and password. I dnt mind. Would that be better to see if your getting the same problem with the php syntax? Still getting the problem ??? Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-177464 Share on other sites More sharing options...
mmarif4u Posted February 6, 2007 Share Posted February 6, 2007 OK if u not mind , give me the username,pass and link of url i will see what the problem is.... Send it to my mail (mmarif4u@yahoo.com) Quote Link to comment https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-177871 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.