Trouble Creating Automatic Table
-
Hi,
It’s my first time writing a WordPress plugin, so this may be an obvious/basic question, but I’m in charge of a newspaper website, and we are trying to keep track of statistics. As such, I am trying to create a table of team names, once, in the WordPress database.
What I have so far to create the table is as follows:
<?php register_activation_hook('__FILE__', 'create_big_table'); function create_big_table () { global $wpdb; $table_name= 'teamlist'; $sql = "CREATE TABLE $table_name ( TeamName varchar(255), TeamNameAbbrv varchar(9), TeamYear varchar(4), HeadCoach text, AsstCoaches text, TeamPhoto file, BeatLink text, GameDate text, WinOrLoss varchar(1), Score varchar (7), Opponent text );"; require_once (ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } ?>
The issue is that the table does not show up in the WordPress database. I would love to know what I’m doing wrong. If there is a better way of creating the table, too, I’d love to know it as well.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Trouble Creating Automatic Table’ is closed to new replies.