prefix . "import_search4location"; if($xml_db->get_var("show tables like" .$table_search4location) != $table_search4location) { $sql = "CREATE TABLE $table_search4location ( LokID varchar(255), venueName varchar(255), PRIMARY KEY(venueName) );"; $xml_db->get_results($sql); } $table_postcode = $wpdb->prefix . "import_postcode"; if($xml_db->get_var("show tables like" .$table_postcode) != $table_postcode) { $sql = "CREATE TABLE $table_postcode ( Postcode int, action int, PRIMARY KEY(Postcode) );"; $xml_db->get_results($sql); } $table_adtracking = $wpdb->prefix . "import_adtracking"; if($xml_db->get_var("show tables like" .$table_adtracking) != $table_adtracking) { $sql = "CREATE TABLE $table_adtracking ( Link varchar(255), action int, PRIMARY KEY(Link) );"; $xml_db->get_results($sql); } $table_event = $wpdb->prefix . "import_event"; if($xml_db->get_var("show tables like" .$table_event) != $table_event) { $sql = "CREATE TABLE $table_event ( EventID int AUTO_INCREMENT, RowID int, eventDateTime DATETIME, url varchar(255), minPrice Decimal(10,2), eventTimUrl varchar(255), eventTimPrice Decimal(10,2), action int, PRIMARY KEY(EventID) );"; $xml_db->get_results($sql); } $table_country = $wpdb->prefix . "import_country"; if($xml_db->get_var("show tables like" .$table_country) != $table_country) { $sql = "CREATE TABLE $table_country ( Name varchar(255), action int, PRIMARY KEY(Name) );"; $xml_db->get_results($sql); } $table_town = $wpdb->prefix . "import_town"; if($xml_db->get_var("show tables like" .$table_town) != $table_town) { $sql = "CREATE TABLE $table_town ( TownName varchar(255), Town_Name varchar(255), Country varchar(255), action int, PRIMARY KEY(TownName) );"; $xml_db->get_results($sql); } $table_location = $wpdb->prefix . "import_location"; if($xml_db->get_var("show tables like" .$table_location) != $table_location) { $sql = "CREATE TABLE $table_location ( LokID varchar(255), venueName varchar(255), venueCity varchar(255), venueAddress varchar(255), venueLongitude float, venueLatitude float, venueImageUrl varchar(255), Postcode int, action int, PRIMARY KEY(LokID) );"; $xml_db->get_results($sql); } $table_events = $wpdb->prefix . "import_events"; if($xml_db->get_var("show tables like" .$table_events) != $table_events) { $sql = "CREATE TABLE $table_events( LokID varchar(255), EventID int, PRIMARY KEY(LokID,EventID) );"; $xml_db->get_results($sql); } $table_date = $wpdb->prefix . "import_date"; if($xml_db->get_var("show tables like" .$table_date) != $table_date) { $sql = "CREATE TABLE $table_date ( eventDateTime DATETIME, action int, PRIMARY KEY(eventDateTime) );"; $xml_db->get_results($sql); } $table_eventrow = $wpdb->prefix . "import_eventrow"; if($xml_db->get_var("show tables like" .$table_eventrow) != $table_eventrow) { $sql = "CREATE TABLE $table_eventrow ( RowID int AUTO_INCREMENT, KiD int, eventName varchar(255), eventDescription Text, action int, minor varchar(255), onsaleStartDateTime DATETIME, PRIMARY KEY(RowID) );"; $xml_db->get_results($sql); } $table_Band = $wpdb->prefix . "import_bandgroup"; if($xml_db->get_var("show tables like" .$table_Band) != $table_Band) { $sql = "CREATE TABLE $table_Band ( KiD int AUTO_INCREMENT, eventName varchar(255), action int, PRIMARY KEY(KiD) );"; $xml_db->get_results($sql); } $table_subcategory = $wpdb->prefix . "import_subcategory"; if($xml_db->get_var("show tables like" .$table_subcategory) != $table_subcategory) { $sql = "CREATE TABLE $table_subcategory ( minor varchar(255), major varchar(255), action int, PRIMARY KEY(minor) );"; $xml_db->get_results($sql); } $table_category = $wpdb->prefix . "import_category"; if($xml_db->get_var("show tables like" .$table_category) != $table_category) { $sql = "CREATE TABLE $table_category ( major varchar(255), action int, PRIMARY KEY(major) );"; $xml_db->get_results($sql); } $count70 = $xml_db->get_var("select count(*) from wp_import_adtracking"); if($count70 == 0) { $xml_db->get_results("INSERT INTO wp_import_adtracking(Link,action) VALUES('http://www1.belboon.de/adtracking/03144d088e8001d76c003a0c.html/&deeplink=',1)"); } } function create_table() { global $xml_db; global $wpdb; global $jal_db_version; $table_search4location = $wpdb->prefix . "import_search4location"; if($xml_db->get_var("show tables like" .$table_search4location) != $table_search4location) { $sql = "CREATE TABLE $table_search4location ( LokID varchar(255), venueName varchar(255), PRIMARY KEY(LokID) );"; $xml_db->get_results($sql); } $table_postcode = $wpdb->prefix . "import_postcode"; if($xml_db->get_var("show tables like" .$table_postcode) != $table_postcode) { $sql = "CREATE TABLE $table_postcode ( Postcode int, action int, PRIMARY KEY(Postcode) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_adtracking = $wpdb->prefix . "import_adtracking"; if($xml_db->get_var("show tables like" .$table_adtracking) != $table_adtracking) { $sql = "CREATE TABLE $table_adtracking ( Link varchar(255), action int, PRIMARY KEY(Link) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $myrows = $xml_db->insert('wp_import_adtracking', array( 'Link' => 'http://www1.belboon.de/adtracking/03144d088e8001d76c003a0c.html/&deeplink=', 'action' => 1, ), array( '%s', '%d', ) ); $table_event = $wpdb->prefix . "import_event"; if($xml_db->get_var("show tables like" .$table_event) != $table_event) { $sql = "CREATE TABLE $table_event ( EventID int AUTO_INCREMENT, RowID int, eventDateTime DATETIME, url varchar(255), minPrice Decimal(10,2), eventTimUrl varchar(255), eventTimPrice Decimal(10,2), action int, PRIMARY KEY(EventID) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_country = $wpdb->prefix . "import_country"; if($xml_db->get_var("show tables like" .$table_country) != $table_country) { $sql = "CREATE TABLE $table_country ( Name varchar(255), action int, PRIMARY KEY(Name) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_town = $wpdb->prefix . "import_town"; if($xml_db->get_var("show tables like" .$table_town) != $table_town) { $sql = "CREATE TABLE $table_town ( TownName varchar(255), Town_Name varchar(255), Country varchar(255), action int, PRIMARY KEY(TownName) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_location = $wpdb->prefix . "import_location"; if($xml_db->get_var("show tables like" .$table_location) != $table_location) { $sql = "CREATE TABLE $table_location ( LokID varchar(255), venueName varchar(255), venueCity varchar(255), venueAddress varchar(255), venueLongitude float, venueLatitude float, venueImageUrl varchar(255), Postcode int, action int, PRIMARY KEY(LokID) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_events = $wpdb->prefix . "import_events"; if($xml_db->get_var("show tables like" .$table_events) != $table_events) { $sql = "CREATE TABLE $table_events( LokID varchar(255), EventID int, PRIMARY KEY(LokID,EventID) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_date = $wpdb->prefix . "import_date"; if($xml_db->get_var("show tables like" .$table_date) != $table_date) { $sql = "CREATE TABLE $table_date ( eventDateTime DATETIME, action int, PRIMARY KEY(eventDateTime) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_eventrow = $wpdb->prefix . "import_eventrow"; if($xml_db->get_var("show tables like" .$table_eventrow) != $table_eventrow) { $sql = "CREATE TABLE $table_eventrow ( RowID int AUTO_INCREMENT, KiD int, eventName varchar(255), eventDescription Text, action int, minor varchar(255), onsaleStartDateTime DATETIME, PRIMARY KEY(RowID) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_Band = $wpdb->prefix . "import_bandgroup"; if($xml_db->get_var("show tables like" .$table_Band) != $table_Band) { $sql = "CREATE TABLE $table_Band ( KiD int AUTO_INCREMENT, eventName varchar(255), action int, PRIMARY KEY(KiD) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_subcategory = $wpdb->prefix . "import_subcategory"; if($xml_db->get_var("show tables like" .$table_subcategory) != $table_subcategory) { $sql = "CREATE TABLE $table_subcategory ( minor varchar(255), major varchar(255), action int, PRIMARY KEY(minor) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } $table_category = $wpdb->prefix . "import_category"; if($xml_db->get_var("show tables like" .$table_category) != $table_category) { $sql = "CREATE TABLE $table_category ( major varchar(255), action int, PRIMARY KEY(major) );"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); add_option( "jal_db_version", $jal_db_version ); } } function delete_table() { global $xml_db; $table_name = $xml_db->prefix . "import_postcode"; $xml_db->query("DROP TABLE IF EXISTS $table_name"); $table_search4location = $xml_db->prefix . "import_search4location"; $xml_db->query("DROP TABLE IF EXISTS $table_search4location"); $table_adtracking = $xml_db->prefix . "import_adtracking"; $xml_db->query("DROP TABLE IF EXISTS $table_adtracking"); $table_event = $xml_db->prefix . "import_event"; $xml_db->query("DROP TABLE IF EXISTS $table_event"); $table_country = $xml_db->prefix . "import_country"; $xml_db->query("DROP TABLE IF EXISTS $table_country"); $table_town = $xml_db->prefix . "import_town"; $xml_db->query("DROP TABLE IF EXISTS $table_town"); $table_location = $xml_db->prefix . "import_location"; $xml_db->query("DROP TABLE IF EXISTS $table_location"); $table_events = $xml_db->prefix . "import_events"; $xml_db->query("DROP TABLE IF EXISTS $table_events"); $table_date = $xml_db->prefix . "import_date"; $xml_db->query("DROP TABLE IF EXISTS $table_date"); $table_eventrow = $xml_db->prefix . "import_eventrow"; $xml_db->query("DROP TABLE IF EXISTS $table_eventrow"); $table_band = $xml_db->prefix . "import_bandgroup"; $xml_db->query("DROP TABLE IF EXISTS $table_band"); $table_subcategory = $xml_db->prefix . "import_subcategory"; $xml_db->query("DROP TABLE IF EXISTS $table_subcategory"); $table_category = $xml_db->prefix . "import_category"; $xml_db->query("DROP TABLE IF EXISTS $table_category"); $_SESSION['link'] = ""; }