• Resolved francescjp

    (@francescjp)


    Hello:

    I am developing a wordpress plugin. I want that when it is being installed I am able to create several tables into wordpress database with sql file. I want to loadfile to database in order to create the tables. If I use text through php the tables are created.

    Thank you very muach.

    Francesc

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Why utilize a SQL file to create tables? Why not keep the SQL in a PHP file as a series of $wpdb->query( $wpdb->prepare( 'CREATE TABLE IF NOT EXISTS...' )); lines executed upon activation?

    In any case, you’d need to get the SQL file contents, parse out the individual queries and execute them in code similar to the above.

    Thread Starter francescjp

    (@francescjp)

    Thank you very much for your help.

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

The topic ‘Load sql file into database from plugin’ is closed to new replies.