title: global variable not working inside function
body: <p>In a wordpress plugin I have this code </p>
  
  <pre><code> $country_table = $wpdb-&gt;prefix . "trackbyid_country";
   $cities_table  = $wpdb-&gt;prefix . "trackbyid_cities";
   function database_creation(){
      global $wpdb;
      global $country_table;
      global $cities_table;
      $AO_name = "trackbyid_dbv";
      $AO_value = "1";
      add_option($AO_name, $AO_value);
  
      $charset_collate = $wpdb-&gt;get_charset_collate();
      $sql = "CREATE TABLE $country_table (
          id mediumint(9) NOT NULL AUTO_INCREMENT,
          time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
          country tinytext NOT NULL,
          PRIMARY KEY  (id)
          ) $charset_collate;";
      require_once ( ABSPATH . 'wp-admin/includes/upgrade.php');
      dbDelta($sql);
      $sql = "CREATE TABLE $cities_table(
          id mediumint(9) NOT NULL AUTO_INCREMENT,
          time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
          city tinytext NOT NULL,
          country_id mediumint(9) NOT NULL,
          city_latitude mediumint(9) NOT NULL,
          city_longitude mediumint(9) NOT NULL,
          PRIMARY KEY  (id)
          ) $charset_collate;";
       dbDelta($sql);
  
  
   }
  </code></pre>
  
  <p>I think my problem (Database is not being created) is with global $country_table and $cities_table variables. when I make that variables as local the problem solves! 
  whats wrong with my global variable declaration and usage?</p>