Jump to content
Sign in to follow this  
samporras

Mysql Database Connection

Recommended Posts

Hi guys.

 

This is a pretty simple question. I'm relatively new to php, and I'm trying to use the php mysql_connect() function to connect to a database I created, but I don't know what to put in for the servername and user.

 

for the server, I wasn't sure if I need put in my domain name, server name (that's indicated in cpanel), or just localhost. I'm assuming that for the username I just put in any of the users I created using the MySQL Database wizard.

 

Thanks in advance.

 

Sam

Share this post


Link to post
Share on other sites

Hope this helps

 

><?php
// Setup database access
$dbhost = "localhost";
$dbuser = "your-domain_your-user";
$dbpass = "database-password";
$dbname = "your-domain_your-filename";
?>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...