require/include using a class ...
| From: | (Mark Walter) | Date: | Tue, 25 Jul 2000 12:33:57 +0000 |
| Subject: | require/include using a class ... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-8009@lists.php.net to get a copy of this message | ||
Hi,
my problem is as follows. My header and footer is included
with 'require' and it works right well:
<? require(footer); ?>
It's html code in opposite to 'class_mysql.php'. I tried to
included them with this example:
<? require(class_mysql.php); ?>
The right's should be ok:
luxer@server:~/bremer > ls -la class_mysql.php
-rwxr-xr-x 1 luxer users 735 Jul 25 13:15 class_mysql.php
Here is the code to be included within the HTML site:
<?
class mysql
{
var $SERVER = "localhost";
var $USER = "root";
var $PASS = "";
var $DBASE = "INTERSWAP";
function error($text)
{
$no = mysql_errno();
$msg = mysql_error();
echo "[$text] ( $no : $msg ) <br> \n";
exit;
}
function init ()
{
$server = $this->SERVER;
$user = $this->USER;
$pass = $this->PASS;
$dbase = $this->DBASE;
$conn = mysql_connect($server, $user, $pass);
if(!$conn)
{
$this->error("no connection ...");
}
if($mysql_select_db($dbase,$conn)
{
$this->error("no database ...");
}
$this-> CONN = $conn;
return true;
}
}
?>
This is my first day creating objects with php so maybe the
problem is sitting 60 cm in front of the code. ;-) I haven't
tried to call the functions. My browser won't show me the
page after included the class either with require nor with
include. So that should be a unregularity as the html code
won't be displayed on my screen.
Any help will be appreciated. Thank's in advance.
cu
--
Mark-Walter@t-online.de