hello,
i was trying connecting to mysql, but getting an error:
Could not connect: Access denied for user ‘epiz_22660366’@‘192.168.0.51’ (using password: YES)
please help!
Thanks
hello,
i was trying connecting to mysql, but getting an error:
Could not connect: Access denied for user ‘epiz_22660366’@‘192.168.0.51’ (using password: YES)
please help!
Thanks
HI @MrJunior @Admin I checked it but still my problem is unresolved. Here’s the php page http://www.campforastronauts.com/donoraction.php?i=1
please help
I can’t help if I can’t check your code and mysql credentials, and you’d better to don’t pass it at all. Check twice your password and wait for Admin.
I checked your code and it looks almost perfect, save for a small typo in your password. If you could make sure the password matches exactly what it’s in the client area, it should work.
Here’s the code,
<?php $servername = "sql313.epizy.com"; $username = "epiz_22660366"; $password = "**********"; $dbname = "epiz_22660366_donation"; $con = mysql_connect($servername,$username,$password, $dbname); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($username, $con); $sql="INSERT INTO epiz_22660366_donation (firstname, lastname, email, orgname, contact, amount, address, mailinglist, gettoknow, pan, permanentdonor) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[email]','$_POST[orgname]','$_POST[contact]','$_POST[amount]','$_POST[address]','$_POST[mailinglist]','$_POST[gettoknow]','$_POST[pan]','$_POST[permanentdonor]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Thank You for making a request! Your record has been added to our servers, You will soon receive an email from our team "; mysql_close($con) ?>here’s the error – Error: No database selected or sometimes it shows Connection Timed Out
Please help me out
thanks
$sql="INSERT INTO epiz_22660366_donation (firstnam...
Is it really your table name?
Also there are some code which shouldn’t be used, suvh as selecting database, because you already define it in mysql_connect(...)
@Harshal_Sharma said:
@Admin I have checked the password many times! Will try once again and let you know!Thanks
There was one extra character in the middle. The password in the config has one more character than the account password.
@Admin I have changed the password again! still it shows Error: No database selected!
Here’s the code
<?php $servername = "sql313.epizy.com"; $username = "epiz_22660366"; $password = "***********"; $dbname = "epiz_22660366_donation"; $con = mysql_connect($servername,$username,$password, $dbname); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($username, $con); $sql="INSERT INTO donate(firstname, lastname, email, orgname, contact, amount, address, mailinglist, gettoknow, pan, permanentdonor) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[email]','$_POST[orgname]','$_POST[contact]','$_POST[amount]','$_POST[address]','$_POST[mailinglist]','$_POST[gettoknow]','$_POST[pan]','$_POST[permanentdonor]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Thank You for making a request! Your record has been added to our servers, You will soon receive an email from our team "; mysql_close($con) ?>mysql_select_db($username, $con)
→
mysql_select_db($dbname, $con)
Documentaion says:
bool mysql_select_db ( string $database_name [, resource $link_identifier = NULL ] )
Also, I’d recommend you to use PDO instead of mysqli or mysql
Based on quide in this link, the mysql_select_db()
should retrieve parameters:
$dbname
based on the code you provided,mysql_connect()
, then I think this function can be ignored.Also, CMIIW. But shouldn’t $_POST
’s array must be written along with pair of quote?
E.g.: $_POST['username'];
@Joo_Nath mysql_connect has no database params, this user better to learn some tutorials and documentation about php functions, instead of complaining here, since he’ve set wrong database with function(database != username) it returned an error and database selection has been reseted.
And no, $_POST/$_GET/anyotherarray can be in quotes, in double quotes, without them, almost no difference.
it worked thanks