Page 1 of 1

i have prob on code with error

Posted: Sat Jul 05, 2003 3:31 pm
by forgun
the error

Code: Select all

Fatal error: Cannot redeclare class func in /home/virtual/site3/fst/var/www/html/il-pc/includes/functions.php on line 2
the cone on that line is

Code: Select all

<?php
class func extends mysql {
	var $dt;
	function s_title($loc) {
		switch ($loc) {
			case "update":
			$this->dt = array (
			'title' => "UpDate Web Site" ,
			'js' => "./includes/bbcode.js"
			);
			break;
			case "menu":
			$this->dt = array (
			'title' => "UpDate Menu Web Site"
			);
			break;
			case "vote":
			$this->dt = array (
			'title' => "UpDate Vote System"
			);
			break;
			case "games":
			$this->dt = array (
			'title' => "UpDate Games Settings"
			);
			break;
			case "settings":
			$this->dt = array (
			'title' => "UpDate Main Setiings Web Site"
			);
			break;
		}
	}
}
?>
why????
here the plave that active the command

Code: Select all

<?php
include ("./includes/functions.php");
$st = new func();
$st->s_title($loc);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<SCRIPT src="<?= $st->dt['js'] ?>" language="javascript"></SCRIPT>
<title>IL-Vortex - PC ( <?= $st->dt['title'] ?> )</title>
plz help me

Posted: Sat Jul 05, 2003 4:00 pm
by cactus
Are you including any other files (other than what's stated above) ? Where is the require/include for the "mysql" class, or is that above the "func" class ?

As a test, try:

Ref : http://uk.php.net/manual/en/function.ge ... -files.php

Regards,

Posted: Sat Jul 05, 2003 4:00 pm
by forgun
mm yap
more two
i dont have
php 5.0
i have 4.3+

Posted: Sun Jul 06, 2003 4:07 am
by m@ndio
I think func is a reserved keyword by PHP. Try changing it to something like eggandchips and see if that works if that does then try and call it something that will not be repeated like func_class or something.

Posted: Mon Jul 07, 2003 3:32 am
by twigletmac
Also, when including class or function files, use include_once() or require_once() so that they aren't reincluded if they've already been included.

Mac

Posted: Mon Jul 07, 2003 6:23 am
by cactus
If your still having an issue, this is a useful method to check which classes have been declared in your script:

syntax : array get_declared_classes ( void )
Ref : http://uk.php.net/get_declared_classes

Regards,