I'm running apache / php / mysql on debian/gnu linux.
I'm basically writing a generic php page that provides a minimal gui for accessing the mysql database.
Here's a sample of the script:
<TD>
Select Database:
<SELECT NAME="StrDatabase">
<?
$res = mysql_query( "SHOW DATABASES" );
while( $arr = mysql_fetch_array( $res ) )
{
print( "<OPTION VALUE=http://www.phpbuilder.com/board/archive/index.php/\"{$arr[ 0 ]}\"" . ( $HTTP_POST_VARS[ "StrDatabase" ]==$arr[ 0 ]?" SELECTED":"" ) . ">{$arr[ 0 ]}\n" );
}
?>
</SELECT>
</TD>
Basically I'm creating a drop down box on the page that a user can select a database to perform the query on.
Now, later on in the script:
<?
if ( $HTTP_POST_VARS[ "StrQuery" ] != "" )
{
$SQL = $HTTP_POST_VARS[ "StrQuery" ];
mysql_select_db( $HTTP_POST_VARS[ "StrDatabase" ] ) or die( "Couldn't select database {$HTTP_POST_VARS[ "StrDatabase" ]}" );
$res = mysql_query( $SQL ) or die( "Could not execute query" );
}
?>
Well, here's the deal. When I try to execute the script on my Linux/Apache box, I get the die() statement on the mysql_select_db call. But the same page on my windows box with php and mysql running on IIS 5 gets no errors and works as expected.
Can anybody help me figure out what's wrong with my apache / mysql configuration?
It would be much appreciated.
Thanks
I'm basically writing a generic php page that provides a minimal gui for accessing the mysql database.
Here's a sample of the script:
<TD>
Select Database:
<SELECT NAME="StrDatabase">
<?
$res = mysql_query( "SHOW DATABASES" );
while( $arr = mysql_fetch_array( $res ) )
{
print( "<OPTION VALUE=http://www.phpbuilder.com/board/archive/index.php/\"{$arr[ 0 ]}\"" . ( $HTTP_POST_VARS[ "StrDatabase" ]==$arr[ 0 ]?" SELECTED":"" ) . ">{$arr[ 0 ]}\n" );
}
?>
</SELECT>
</TD>
Basically I'm creating a drop down box on the page that a user can select a database to perform the query on.
Now, later on in the script:
<?
if ( $HTTP_POST_VARS[ "StrQuery" ] != "" )
{
$SQL = $HTTP_POST_VARS[ "StrQuery" ];
mysql_select_db( $HTTP_POST_VARS[ "StrDatabase" ] ) or die( "Couldn't select database {$HTTP_POST_VARS[ "StrDatabase" ]}" );
$res = mysql_query( $SQL ) or die( "Could not execute query" );
}
?>
Well, here's the deal. When I try to execute the script on my Linux/Apache box, I get the die() statement on the mysql_select_db call. But the same page on my windows box with php and mysql running on IIS 5 gets no errors and works as expected.
Can anybody help me figure out what's wrong with my apache / mysql configuration?
It would be much appreciated.
Thanks