function get_points_multiplier() { global $wpdb; $points_info_table_name = get_points_info_table_name(); $points_multiplier = $wpdb->get_results("SELECT multiplier FROM {$points_info_table_name} WHERE id = 1 LIMIT 1"); $points_multiplier = $points_multiplier[0]->multiplier; return $points_multiplier; }
function build_points_info_sql() { global $wpdb; $table_name = get_points_info_table_name(); $sql = "DROP TABLE IF EXISTS " . $table_name . ";"; $wpdb->query($sql); $sql = "CREATE TABLE " . $table_name . " (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `symbol` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '\$',\n `singular` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n `plural` varchar(50) COLLATE utf8_unicode_ci NOT NULL,\n `multiplier` double(7,2) NOT NULL DEFAULT '1.00',\n PRIMARY KEY (`id`)\n );"; $sql .= "INSERT INTO " . $table_name . " (\n `symbol`, `singular`, `plural`, `multiplier`\n ) VALUES(\n '\$', 'dollar', 'dollars', '1'\n );"; return $sql; }