PDA

View Full Version : DW8 issues with Recordset and MySQL DB



BecksEhlers
04-26-2007, 01:04 AM
Hello!

I am very new to all this PHP and MySQL stuff, though I have been trawling the internet for the last 2 days trying to find solutions, so I'm learning fast!

My issue is that I am using DW8 and am having problems connecting to my remote DB.

The remote server does have PHP. I actually did manage to create a table in the database from another program (I wanted to check they had PHP since it was a holiday here and my server's tech support were not there) and I was able to do that, so I know they support it.

I have noticed 2 things:

1 - If I try to create a MySQL connection, although all the information I have put in is correct, when i test it, it comes up with the following error message:

Error code 404 file not found...here are some possible reasons:

1 - There is no testing server running on the server machine
2 - The testing server specified to this site does not map to the http://lunar-essence.com/htdocs/_mmServerScripts/MMHTTPDB.php URL.

2 - the second thing I have noticed is that the database DOES show in the Application (Databases) window on the right, but it shows no table. This is also the case when I try to create a recordset - it sees the database, but refuses to see the table.

It is my understanding that I do not really need PHP or MySQL installed on my local machine, but I have installed anyway.

If anyone can shed light on this I would be so grateful. I do not wish to use another editor if I can help it as I am more of a visual designer than a code writing one, and all I'm trying to do is set up a little search engine for my website.

Please let me know if there is any info that you need to make this make sense.

Many thanks....

boxxertrumps
04-26-2007, 01:54 AM
without the htdocs folder (just http://lunar-essence.com/_mmServerScripts/MMHTTPDB.php) i get:

<?php // <ERRORS><ERROR><DESCRIPTION>Your testing server do not has support for PHP pages</DESCRIPTION></ERROR>\n</ERRORS>
$debug_to_file = false;
function log_messages($error_message){
global $f, $debug_to_file;
if ($debug_to_file === true){
if (!is_resource($f)){
@ini_set('display_errors', 1);
@error_reporting(E_ALL);
$f = @fopen('log.txt', 'a');
}
if (is_resource($f)){
return @fwrite($f, $error_message."\n");
}
}
return false;
}
function create_error($error_msg = '', $line = -1){
if ($error_msg != ''){
return '<ERRORS><ERROR><DESCRIPTION>'.$error_msg.'</DESCRIPTION></ERROR></ERRORS>\n';
}else{
return '<ERRORS><ERROR><DESCRIPTION> Unidentified Connection Error at Line '.$line.'</DESCRIPTION></ERROR></ERRORS>\n';
}
}
log_messages("\n--------------------------------");
// what parameters were sent ?!
foreach($_POST as $key=>$value) {
if (strtoupper($key) != 'PASSWORD'){
log_messages('$_POST["'.$key.'"] = \''.$value."';");
}
}
// We need these information only once when the test button is hit
if (isset($_POST['opCode']) && $_POST['opCode'] == 'IsOpen' ){
// What PHP version
log_messages("\nPHP-Version: ".phpversion());
// What OS System is running on
log_messages('PHP-OS: '.PHP_OS);
// How PHP is installed (CGI, ISAPI, FastCGI)
// !!!! Major difference exists on these servers for $_ENV, $_SERVER
log_messages('PHP-SAPI-NAME: '.php_sapi_name());
// MySQL, mbstring modules are installed ?!
log_messages('PHP-Extensions: '.var_export(get_loaded_extensions(),true));
}
if(extension_loaded('mbstring'))
{
$acceptCharsetHeader = 'Accept-Charset: ' . mb_internal_encoding();
header( $acceptCharsetHeader );
$head = '<html><head><meta http-equiv=\'Content-Type\' content=\'text/html; charset=' . mb_http_output() . '\'></head>';
echo $head;
}else{
echo '<html><head></head>';
}
// Build connection object
if (isset($_POST['Type']) && $_POST['Type'] == 'MYSQL')
{
require("./mysql.php");
$oConn = new MySqlConnection(@$_POST['ConnectionString'], @$_POST['Timeout'], @$_POST['Host'], @$_POST['Database'], @$_POST['UserName'], @$_POST['Password']);
if (!isset($oConn) || $oConn == false){
log_messages("\n".'MySQL Connection Object initialisation failed'."\n\n".@$error);
}else{
log_messages("\n".'MySQL Connection Object Created'."\n\n");
}
}else{
$error=create_error('The files from the _mmServerScripts folder are for the server model PHP-MySQL. You try to connect to a database using a different server model '.@$_POST['Type'].".\n\nPlease remove this folder outside the Dreamweaver environment on both local and testing machines and try again.",__LINE__);
log_messages("\nError Sent:\n\n\t".@$error."\n\n\n");
echo $error.'</HTML>';
return;
}
// Process opCode
if (isset($oConn) && $oConn)
{
$oConn->Open();
if ($_POST['opCode'] == 'IsOpen'){
$answer = $oConn->TestOpen();
}elseif (is_resource($oConn->connectionId) && $oConn->isOpen){

switch ($_POST['opCode']){
case 'GetTables': $answer = $oConn->GetTables(@$_POST['Database']); break;
case 'GetColsOfTable': $answer = $oConn->GetColumnsOfTable(@$_POST['TableName']); break;
case 'ExecuteSQL': $answer = $oConn->ExecuteSQL(@$_POST['SQL'], @$_POST['MaxRows']); break;
case 'GetODBCDSNs': $answer = $oConn->GetDatabaseList(); break;
case 'SupportsProcedure': $answer = $oConn->SupportsProcedure(); break;
case 'GetProviderTypes': $answer = $oConn->GetProviderTypes(); break;
case 'GetViews': $answer = $oConn->GetViews(); break;
case 'GetProcedures': $answer = $oConn->GetProcedures(); break;
case 'GetParametersOfProcedure': $answer = $oConn->GetParametersOfProcedure(@$_POST['ProcName']); break;
case 'ReturnsResultset': $answer = $oConn->ReturnsResultSet($_POST['RRProcName']); break;
case 'ExecuteSP': $answer = $oConn->ExecuteSP(@$_POST['ExecProcName'], 0, @$_POST['ExecProcParameters']); break;
case 'GetKeysOfTable': $answer = $oConn->GetPrimaryKeysOfTable(@$_POST['TableName']); break;
default: $answer = create_error('The \''.$_POST['opCode'].'\' command is not supported.'); break;
}
}
$oConn->Close();
}else{
$answer = create_error('The Connection Module was not initialized properly for an unknown reason.');
}
log_messages("\nAnswer From Database:\n\n\t".@$answer."\n\n\n");
echo $answer;
echo '</html>';
?>

Weird... Also, you should learn how the code works, so you'll be able to fix design problems on your own...

BecksEhlers
04-26-2007, 03:38 AM
Hi

I tried it all without htdocs in the URL. Again, it all tested fine connecting to the server but when I tried to test the MySQL connetion it came up with a different message "Access denied. The file may not exist or there may be a permission problem."



Thanks for the helpful advice about learning code. I am trying to learn as much as I can as I encounter issues, but as I said, I would much rather use dreamweaver to do this as it will be much quicker for me.

Is this really a php code thing? Seems to me it may be a DW issue? Probably showing my ignorance here.... I am really am stuck - I have trawled the internet for hours and no-one has been able to come up with a solution that I can find so far. I wouldn't be posting otherwise, I promise!