I got it working perfectly on a Linux server, but my boss wants this on a Windows IIS server. <sigh>

The remote connection seems to be working now but I have another problem now... the page is not doing anything - doesn't seem to be connecting to the database, but I got no error messages whatsoever. The page just indicated Done on the bottom. The mysql_connect.php file is listed below. Is there a privilege problem or is there something else I need to enable?

Much thanks.
Kay

<?php # Script - mysql_connect.php

// This file contains the database access information for the database. This file also establishes a connection to MySQL and selects the database.

// Set the database access information as constants.
define ('DB_USER', 'username);
define ('DB_PASSWORD', 'userpass');
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'databasename');

// Make the connnection and then select the database.
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() ); mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );

// Function for escaping and trimming form data.
function escape_data ($data) {
        global $dbc;
        if (ini_get('magic_quotes_gpc')) {
                $data = stripslashes($data);
        }
        return mysql_real_escape_string (trim ($data), $dbc);
} // End of escape_data() function.
?>

At 10:53 AM 1/18/2007 Thursday, Chris White wrote:
Just to toss something else in here. A lot of times you have a server that you can connect to by ssh, but because of firewalls, can't access mysql through. If you can, however, connect to the database through ssh, you can do port forwarding. In *nix systems it should be something like this:

ssh -L 3306:server.com:3306 -N -f [EMAIL PROTECTED]

This will forward requests from port 3306 locally to port 3306 on server.com. If you're on windows, you can also do port forwarding through putty:

http://www.cs.uu.nl/technical/services/ssh/putty/puttyfw.html

This becomes pretty easy when you get the hang of it.  You can also do like:

ssh -L 3000:server.com:3306 -N -f [EMAIL PROTECTED]

if you're, say, running a local mysql instance. As a reminder connections will have to occur to localhost, not the server. Hope this helps.

Reply via email to