• I want to create one extra table filed if it is multisite’s main blog (While plugin activation).

    I mean like this

    if (main blog) {
      execute this sql;
    }
    else {
      execute this sql
    }

    Can anyone help me?

    PS: This is the code for “execute this sql”.

    If child blog:

    $sql = "CREATE TABLE tablename (
                      id bigint(20) NOT NULL AUTO_INCREMENT,
                      uid bigint(20) NOT NULL,
                      type VARCHAR(256) NOT NULL,
                      data TEXT NOT NULL,
                      credits bigint(20) NOT NULL,
                      timestamp bigint(20) NOT NULL,
                      UNIQUE KEY id (id)
                    );";

    If main blog:

    $sql = "CREATE TABLE tablename (
                  id bigint(20) NOT NULL AUTO_INCREMENT,
                  uid bigint(20) NOT NULL,
                  type VARCHAR(256) NOT NULL,
                  data TEXT NOT NULL,
                  credits bigint(20) NOT NULL,
                          globalcredits bigint(20) NOT NULL,
                  timestamp bigint(20) NOT NULL,
                  UNIQUE KEY id (id)
                );";
  • The topic ‘How to check main blog in a multisite using if statement?’ is closed to new replies.