I have a website plus database with details like username, password and database name. Now I want to connect and use this database into another website. I tried to include, for example

include('http://domainname.com/connect/db.php');

but unable to run query. How I can do this ?

Recommended Answers

All 7 Replies

to access another server mysql data, you need to have permission to do so in mysql. If you know administrator you can ask him to allow access to the server.

when you buy any server space, they alwyas provide all 4 parameter like servername , database name, username and password for mysql.

so where is database server, ask them to provide the info. or if u can login to there system. you may find such information somewhere in ur account

I have cPanel login details.. How I can find database server.. ?

The links are asking login details..

no
it is cpanel demo
same way when you login to your cpanel account u find same databae section
on left side you can see "server"
then you have to create users for your mysql database, you have to give privilleages to your user to your database. (this username/pwd/database can be used to login to mysql database)

to allow remote access to mysql you need to give remote (your static ip address if you have)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.