Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    I had the same problem today and resolved it. dbDelta function is not working.
    Instead use $wpdb->query function.

    For eg. to create a table named mytable with 3 fields id, name and value with id as the primary key use the following code in the install function.

    $table_name = “mytable”;
    $sql = “CREATE TABLE IF NOT EXISTS " . $table_name . " (
    id int(10) NOT NULL AUTO_INCREMENT,
    name VARCHAR(25) NOT NULL,
    value VARCHAR(45) NOT NULL,
    PRIMARY KEY (id)
    );” ;

    $wpdb->query($sql);

    Hope it helps.

    Thanks,
    nallu

    Forum: Hacks
    In reply to: Custom Field Hack
    Thread Starter nallu

    (@nallu)

    thanks for the reply

Viewing 2 replies - 1 through 2 (of 2 total)