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

Update a database table on addon install

Nudaii

Well-known member
#1
I am pretty new to writing php, and i know i have something wrong in this code, but can't work out exactly what it is.
PHP:
<?php

class RrwsTitlePlus_Install
{
    protected static $table = array(
        'installrrwstrop' => 'UPDATE xf_user SET custom_title => TestTitle'

    );
    public static function install()
    {
        $db = XenForo_Application::get('db');
        $db->query(self::$table['installrrwstrop']);
    }


}
any ideas?
 

Nudaii

Well-known member
#4
PHP:
<?php
class RrwsTitlePlus_Install
{
  protected static $table = array(
  'installrrwstrop' => 'UPDATE xf_user SET custom_title = TestTitle'
  );
  public static function install()
  {
  $db = XenForo_Application::getDb();
  $db->query(self::$table['installrrwstrop']);
  }
}
gives this error

Mysqli prepare error: Unknown column 'TestTitle' in 'field list'

Basically i need to set default content to all custom usertitles upon addon install.

i appreciate you guys help.