My phpmyadmin is inside the server. I want to connect my database from my remote PC to the database in the server using php. I would greatly appreciate if someone can suggest a way to connect the database remotely in windows platform.
Thank you.

Recommended Answers

open link in your browser

give root/pwd
I assume that phpmyadmin is installed on the web root folder

Jump to Post

All 2 Replies

Set your GLOBALS in a constants.inc.php file, or something similar. So;

$db_server would be: (for example)
$db_user would be: (for example) root
$db_pass would be: (for example) password

Use this as a function to connect to your databases in your code.

function dbConnect()
    @mysql_connect($GLOBALS['db_server'], $GLOBALS['db_user'], $GLOBALS['db_pass']) or trigger_error("Could not connect to MySQL database", E_USER_ERROR);
function dbOpenDatabase($dbName)
    @mysql_select_db($dbName) or trigger_error("Unable to access $dbName database", E_USER_ERROR);

To connect to your database, simply do this in the code where you'd like to connect;


To connect to your databases through phpMyAdmin to make changes, etc etc; in your browser - simply do your webservers IP address or domain name like so.

Be a part of the DaniWeb community

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