Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I want to connect to a database on GoDaddy and insert some values into it. All the codes are in place and it works on the localhost. Though I don't know how to connect to the online database. I selected the remote hosting option when creating the database on their web interface.

It doesn't work with the localhost as obviously they are not hosted on the same server.

Exactly what I want to know is what I have to write into this.

$con = mysql_connect("WHATINEEDTOWRITE","username","password");
//note that mysql_connect is just given as an example to help clarify the situation.

1 Answer

0 votes
by (12.7k points)

GoDaddy runs its database servers off a remote host.

So, your $con statement will appear like the following:

$con = mysql_connect("USERNAME.db.123456789.hostedresource.com", "DATABASE_USERNAME", "DATABASE_PASSWORD");

You would then need to select the database in the following statement.

Join the SQL Training course if you want to gain more knowledge in SQL.

Do check out the below MySQL tutorial video that will help you out in a better way:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...