• I have referred to http://codex.wordpress.org/Creating_Tables_with_Plugins, but it’s not helping me with my issue.

    I am writing a plugin that requires the creation of numerous tables. I have an .sql file with the desired SQL, which I read into a $sql variable.

    Is there a simple way to execute all of that SQL in one shot? The $wpdb->query($sql) function trips up if there is more than one SQL query.

    If necessary, I can parse by semi-colons and loop through, executing each query individually, but that seems messy.

Viewing 1 replies (of 1 total)
  • You don’t have to use the $wpdb object. I’d loop through if it were me, using the dbDelta function, but you don’t have to.

Viewing 1 replies (of 1 total)
  • The topic ‘Creating tables from .sql on plugin activate’ is closed to new replies.