I spent an age trying to work out why I couldn’t post a simple e-mail address to a PHP database. Everytime I tried to test submitting the form using my local server I got the following message:
Warning: mysql_connect() [function.mysql-connect]: No such file or directory
I was using the following connection string:
mysql_connect ("localhost", "root", "xxxx", "my_fdb") or die ('Error: ' .mysql_error());
It turns out that when I changed “localhost” to the actual ip address and port of my local mySQL database, the error disapeared:
mysql_connect ("127.0.0.1:3306", "root", "xxxx", "my_fdb") or die ('Error: ' .mysql_error());
Now if I was on a windows machine I would have known where to go to edit my locahosts file, but on a mac I haven’t the first clue and right now I don’t care, I’m just pleased that I’m now able to write to and read from my local database.