• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Problem with install and uninstall code

Matthew Hawley

Well-known member
#1
I get this error when I try to save.


Here is my code for Install.php

Code:
<?php

class CF_Directory_Install {

  public static function install($addon) {

    $db = XenForo_Application::get('db');

    $db->query("CREATE TABLE IF NOT EXISTS `xf_ci_directory_pages` (

                  `page_id` int(11) unsigned NOT NULL AUTO_INCREMENT,

                  `route` varchar(25) NOT NULL DEFAULT '',

                  `display_order` int(11) NOT NULL DEFAULT '0',

                  PRIMARY KEY (`page_id`)

                ) ENGINE=InnoDB  DEFAULT CHARSET=latin1;");

  }

class CF_Directory_Uninstall {

  public static function uninstall() {

    $db = XenForo_Application::get('db');

    $db->query("DROP TABLE `xf_cf_directory_pages`;");

  }

}
 

Brogan

XenForo moderator
Staff member
#2
You are dropping the wrong table: $db->query("DROP TABLE `xf_cf_directory_pages`;");

Regardless, posting the error message next time would help.
 

Matthew Hawley

Well-known member
#5
Now when I try it, I get this.

Parse error: syntax error, unexpected T_CLASS, expecting T_FUNCTION in /home3/xxx/public_html/xxx/library/CF/Directory/Install.php on line 27