Here's my problem. I'm trying to create a database class to use as an 'include' file. I should first start off by saying i'm using Zend Development environment as my IDE. I've created the include file and here is the code for that..
Code: Select all
//database_include.php
Class clsData
{
Function dbconn()
{
$connection = mysql_connect("myserver", "myusername", "mypassword");
if(!connection)
{
echo mysql_error();
}
else
{
echo "Successful connection";
}
$selection = mysql_select_db("mydatabase");
if(!selection)
{
echo ("Database was not selected");
}
else
{
echo("Database was selected fine");
}
}
}
Here is the page I'm using to try and output the results:
Code: Select all
//test.php
<?php include ("mydirectory/database_include.php"); ?>
<?php
$cls = new clsData;
$cls->dbconn();
?>
Here's the strange thing. When I run
test.php inside the Zend Studio IDE by using Debug > Run, the results display
correctly in the debut output screen inside the Zend IDE. But when I try to run
test.php from my browser, either firefox or IE, I get a completely blank screen. Blank white screen, I go an view source and there's absolutely nothing there. It appears to work (theoretically) because I can see the correct output through the debug output window in Zend Studio. As you can see this code is pretty straightforward and is strictly for testing purposes; I want to see if I can work with a database include file. Any ideas? Has anyone seen this strange (or maybe not so strange) error? If I am not being thorough enough please let me know and I will do my best to be more thorough and clearer. Thanks in advance.