Cannot Connect to DB using PHP

  • Answered
I have followed the sample in the tutorial series -

and found each tutorial very helpful, thank you!

I was able to create the db and table and have inserted the html code and php into the script module (using the premium web builder wizard). I continue to receive an error in connecting to the DB and do not know how to determine what the error is. I have modified the below statement to input the correct userid and password for the database.

Could the error be that the localhost is not finding the database? Since the php code was not placed in the File Manager section that the sample states and the comments state "because the database lives on the same physical server as our php code, we are connecting to localhost". Is this where the problem lies if I have inserted the html and all sample code into the script module in the premium builder module?

$con = mysql_connect("localhost","userid","mypassword");

Hello Kathe,

Without seeing the entire code, I would not be able to answer whether that line is incorrect, but as a general code statement it appears to be correct. 'Localhost' is definitely the setting you want to use on the server.

I was unable to find a page on your site that seemed to be having an issue. I may need a bit more information so I can take a look at the actual code and test it. You can send the specific information to [email protected] Be sure to validate your account with either the last 4 digits of the credit card on file, or the current Account Management Panel (AMP) password. As we do not actively monitor that address, be sure to leave a comment below so we know the information was sent. I would also need the builder password to access that area to get the code itself.

Best Regards,
Scott M