Getting PHP to talk with mySQL
Posted by: tr394
Posted on: 2003-04-04 06:47:00
Hello list,
I'm teaching myself basic PHP to mySQL programming and seem to be hung up or something. I keep getting an unable to connect message and feel I have the initial connection path to my mySQL account at Dreamhost wrong. This is the code I'm using (it's a webmonkey tutorial) followed by the error message(s) I'm getting. Obviously, the real code has my real login and password but I've left those areas generic for my privacy. I do have that info in the code on the server. 'testingphp.kselected.com' is the hostname i've set up for the db. Any help would be greatly appreciated. Thanks in advance.
<html>
<body>
<?php
mysql_connect (testingphp.kselected.com, mylogin, mypassword);
mysql_select_db (testingPHP);
mysql_query ("INSERT INTO submitForm1 (firstName, lastName)
VALUES ('$firstName', '$lastName')
");
print ($firstName);
print (" ");
print ($lastName);
print ("<p>");
print ("Thanks for submitting your name.");
?>
</body>
</html>
and i get back.
Warning: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/.abbey/tr394/kselected.com/ITP/Grow/Captions/submitform.php on line 5
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/.abbey/tr394/kselected.com/ITP/Grow/Captions/submitform.php on line 5
Warning: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/.abbey/tr394/kselected.com/ITP/Grow/Captions/submitform.php on line 7
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/.abbey/tr394/kselected.com/ITP/Grow/Captions/submitform.php on line 7
Warning: MySQL: A link to the server could not be established in /home/.abbey/tr394/kselected.com/ITP/Grow/Captions/submitform.php on line 7
Warning: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/.abbey/tr394/kselected.com/ITP/Grow/Captions/submitform.php on line 11
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/.abbey/tr394/kselected.com/ITP/Grow/Captions/submitform.php on line 11
Warning: MySQL: A link to the server could not be established in /home/.abbey/tr394/kselected.com/ITP/Grow/Captions/submitform.php on line 11
Tim