title: How to combine data from two different tables into a variable
body: <p>Can anyone tell me how I can compare a variable that stores a country with 2 tables in the database?</p>
  
  <p>I have this data in the database:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> country            values
  PT|AU|USA       0.03|0.04|0.05</code></pre>
  </div>
  </div>
  </p>
  
  <p>And I have a variable that will store one of three values: EN, AU, USA
  I would like this to get the data from the two tables but in the correct order.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>PT      =&gt; 0.03
  AU      =&gt; 0.04
  USA     =&gt; 0.05</code></pre>
  </div>
  </div>
  </p>
  
  <p>I tried this way but it didn't work</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>$countries  = $get1x["country"];
  $values     = $get1x["values"];
  
  $tags    = explode('|' , $countries);
  $tags2   = explode('|' , $values);
  
  $country  = "";
  $value    = 0.0;
  
  foreach($tags as $i =&gt; $key) {
      $i &gt; 0;
      $value = str_split($key, $ii);
  }
  foreach($tags2 as $i2 =&gt; $key2) {
      $i2 &gt; 0;
      $value = str_split($key2, $iii);
  }
  
  print_r($country);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Can anyone tell me a way?</p>