I am sure that it works, however not at my internet service provider (Yahoo Small Business account), because at running this code bringing an error message:
Error!: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (96)
I would like to understand what does that mean and eventually what to change for having it working. With other methods with other php codes I am able to login to the database and running queries, but with this one not
Thanks,
MySQL ServerPHPDatabases
Last Comment
Dave Baldwin
8/22/2022 - Mon
Dave Baldwin
That means that you probably have not used the correct credentials. Many hosting companies did not put the MySQL server on the same machine as the web site. That would use 'localhost'. There is probably a different server name or IP address for the MySQL server for your account. You need to look it up and use that.
I noticed (after posting) that he said that he could connect "with other php codes". He probably just needs to copy the credentials from those files to this one.
csehz
ASKER
Thanks very much the answers, sorry for the late during the holidays period was not able to test it.
Yes as you also mentioned with other codes I can login without any issue, for example with this:
<?Php$connect = mysql_connect("mysql", "xx", "xx") or die ("Check your server connection."); $k = "SET NAMES latin2"; mysql_query($k); mysql_select_db("lang") or die(mysql_error());?>
Comparing this code to that original one in the question, which is maybe not clear the $db_host = "localhost"; but in my understanding that should be left as unchanged?