• Hello,

    I have created a plugin called “CreateCustomTable”.
    In this directory I have 2 files: “CreateCustomTable” and “create.php”.
    The “CreateCustomTable” php file has a button that is forwarded to “create.php” which is suppose to create a custom table called “wp_prod_info”. However this is not working. Could someone let me know what I’ve done wrong?

    create.php code below……

    <?php

    $table_name = “wp_product_info”;

    $sql = “CREATE TABLE ” . $table_name . ” ( “;
    $sql .= “prod_id mediumint(9) NOT NULL AUTO_INCREMENT, “;
    $sql .= “prod_name VARCHAR(100) NOT NULL, “;
    $sql .= “prod_details VARCHAR(255) NOT NULL, “;
    $sql .= “prod_reg_price DECIMAL(4,2) NOT NULL DEFAULT ‘0.00’, “;
    $sql .= “prod_sale_price DECIMAL(4,2) NOT NULL DEFAULT ‘0.00’, “;
    $sql .= “prod_image_url VARCHAR(255) “;
    $sql .= ” ); “;

    print (“$sql
    “);

    $sPath = “http://www.eastcoasttechwriter.ca/wp-admin/includes/upgrade.php&#8221;;

    require_once($sPath );

    dbDelta($sql);

    ?>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘My php code is not creating a table’ is closed to new replies.