HELP WITH SCRIPT. GETTING ERROR ” CAN’T CONNECT TO MYSQL SERVER ON ‘MYSQLDB’ (111). CAN YOU HELP?

Question by bkrue514:
Help with script. Getting error ” Cannot connect to MySQL server on ‘Mysqldb’ (111). Can you help?
I am trying to get this php script loaded. It is one for buying words.
For some reason when I add a word in the /admin then it states “Can’t connect to MySQL server on ‘mysqldb’ (111)”
I have no clue what that means. Another weird thing is that I changed the foote and header, and it is changed in the main site, but when I go to /admin then it all looks the way it did when I uploaded it. Is something messed up?
Here is what the db looks like
$dbuser = "user";
$dbpass = "password";
$dbname = "buymeaword";
$hostname = "localhost";
$adminu = "user";
$adminp = "password";
$adminu = "user";
$adminp = "password";
$notify_url = "http://www.midmichiganads.com/bmaw/admin"; //where ipn_res.php is
$notify_url2 = "http://www.midmichiganads.com/bmaw/admin"; //where ipn_res2.php is
$return_page = "http://www.midmichiganads.com/"; //the main site url
$my_paypal = "@yahoo.com"; //your primary paypal address
$my_error = "@yahoo.com"; //the email where notifications will be send to
$adsense_pub="pub-0999107265272012";
$affid="395"; //your affiliate ID to promote Purchase me a Word script - check the user's guide to see how you can get this affiliate ID
$money_currency = "USD"; // USD, GBP, JPY, CAD, EUR
mysql_connect(localhost,user,password);
mysql_select_db(buymeaword);
?>
Obviously my username and password are not user/password,but is there anything wrong with this? The bottom of the thing is:
“mysql_select_db(buymeaword)”
and my error is :
“Can’t connect to MySQL server on ‘mysqldb’ (111)”
they both have “mysqldb” in them. Not sure if this helps or not. If you do not know then do not worry about it. I am just trying to figure out how to add words.
the site is www.midmichiganads.com/bmaw
——————————————
Answer by Crehl
From my limited knowledge, of PHP, Try:
mysql_connect($hostname, $dbuser, $dbpass)
mysql_select_db($dbname)
Could well be wrong, have not used either PHP nor MYSQL for a couple of years.
——————————————
What do you think? Answer below!









about 2 years ago
try
good luck.
about 2 years ago
use a bunch of line breaks –
about 2 years ago
It’s hard to tell you what code to use as you don’t mention what you need the vertical space for. There is a vspace=”" attribute that is normally used in image tags. There’s the CSS property vertical-align: xxpx; . There are other CSS properties that you might be able to use, but can’t tell you which with such limited information that you gave.
Ron
about 1 year ago
If you want the buymeaword database you will need to say:
mysql_select_db($dbname);
or
mysql_select_db(“buymeaword”);
That is what your problem will be providing of course you are doing the same in the mysql_connect function which is referencing your variables or strings i.e. mysql_connect(“localhost”,”user”,”password”)