Using XAMPP and external MySQL database

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Eric1982
User
Posts: 57

Using XAMPP and external MySQL database

Post by Eric1982 »

I have setup the database details according to ''Database_Connecting'' with the details of my webhosting package. But I would like to use (develop) the software locally with XAMPP first.

The code appears after I generated the code and visit the web application.

The code of the Database_Connecting event is:
// MySQL/PostgreSQL
function Database_Connecting(&$info) {
//var_dump($info);
// assume the scripts are generated with connection info for local PC
if (ew_CurrentUserIP() <> "127.0.0.1") { // not connecting to local PC
// connect to the production database
$info["host"] = "localhost";
$info["user"] = “username”;
$info["pass"] = “password”;
$info["db"] = “database”;
}
}

When I replace this code to the default settings, no error appears.

This is the error message:

Failed to connect to uwportaal_com_beta at localhost:3306. Error: Access denied for user 'uwpo_com_beta'@'localhost' (using password: YES)
Failed to connect to uwportaal_com_beta at localhost:3306. Error: Access denied for user 'uwpo_com_beta'@'localhost' (using password: YES)


Webmaster
User
Posts: 9427

Post by Webmaster »

Write a simple script to echo $_SERVER["REMOTE_ADDR"] (what ew_CurrentUserIP() returns) on your local and remote server respectively to find out the IPs on each server, then use (either of) them in the server event to compare with ew_CurrentUserIP().


Eric1982
User
Posts: 57

Post by Eric1982 »

Thanks. The problem has been resolved. I just added the IP address of my PC in the field "put your local PC IP address here" see below. I have uploaded the files
to my webhost and it automatically detects the right settings.

Thank you for your help and patience.

// MySQL/PostgreSQL
function Database_Connecting(&$info) {
//var_dump($info);
// assume the scripts are generated with connection info for local PC
if (ew_CurrentUserIP() <> "put your local PC IP address here") { // not connecting to local PC
// connect to the production database
$info["host"] = "localhost";
$info["user"] = "uwpo_com_beta";
$info["pass"] = "password12345";
$info["db"] = "port_example_database";
}
}


Post Reply