Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176065
Share on other sites

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);

 

?>

Link to comment
https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176350
Share on other sites

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);

?>

Link to comment
https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176412
Share on other sites

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. 

Link to comment
https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176418
Share on other sites

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]

Link to comment
https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-176901
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-177225
Share on other sites

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...

Link to comment
https://forums.phpfreaks.com/topic/36906-php-connection-error/#findComment-177234
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.