Newbie Question

From: Date: Wed, 26 Feb 2003 03:47:13 +0000
Subject: Newbie Question
Groups: php.general 
Request: Send a blank email to php-general+get-137185@lists.php.net to get a copy of this message
Can someone explain why this code works on the hosting company's server, but won't run on my local server? I'm not sure what version is on the host server, but I'm running 4.0.5 locally on winXP Pro. The error says: Fatal error: Cannot redeclare dbfield() in c:\inetpub\wwwroot\livinginnaples\database.php on line 30 7.class DBField 8.{ 9. var $name; 10. var $type; 11. var $table; 12. var $title; 13. 14. var $size; 15. var $rows; 16. var $maxlength; 17. var $value; 18. var $prefix; 19. var $postfix; 20. var $display; 21. 22. function DBField() 23. { 24. $name = ""; 25. $table = ""; 26. 27. $this->display = true; 28. } 29. 30. function DBField( $name, $table, $size, $value ) 31. { 32. if( $size == "" ) $size=20; 33. $this->display = true; $this->name = $name; $this->table = $table; $this->size = $size; $this->rows = 5; $this->value = $value; $this->title = ucwords( $name ); } function display() { if( !$this->display ) return; $prefix = str_replace( "[TITLE]", $this->title, $this->prefix ); echo $prefix; switch( $this->type ) { case "blob": ?> <textarea cols="<? echo $this->size ?>" rows="<? echo $this->rows ?>" name="<? echo $this->name ?>"><? echo $this->value ?></textarea><? break; case "date": if( $this->value != "" ) $time = strtotime( $this->value ); else $time = strtotime( "now" ); ?> <input type="text" size="2" maxlength="2" name="<? echo $this->name ?>m" value="<? echo date( "m", $time ) ?>">/<input type="text" size="2" maxlength="2" name="<? echo $this->name ?>d" value="<? echo date( "d", $time ) ?>">/<input type="text" size="4" maxlength="4" name="<? echo $this->name ?>y" value="<? echo date( "y", $time ) ?>"> <? break; default: ?><input type="text" size="<? echo $this->size ?>" maxlength="<? echo $this->maxlength ?>" name="<? echo $this->name ?>" value="<? echo $this->value ?>"><? break; } echo $this->postfix . "\r\n"; } }

« previous php.general (#137185) next »