title: concatenate 3 columns with MySQL in PHP
body: <p>I have an Android app that will POST the category variable to my PHP. In my PHP i wand to find the category (column) the buyer is interested in and then in that row concatenate the 3 other columns from that same row. Then save that into a variable which i will echo out.</p>
  
  <p><a href="https://i.stack.imgur.com/MONg6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MONg6.jpg" alt=""></a></p>
  
  <blockquote>
    <p>i realize there are multiple products listed in the same category but that is a different question.</p>
  </blockquote>
  
  <p>PHP code:</p>
  
  <pre><code>&lt;?php
  
  $conn = mysqli_connect("phpmyadmin.cvw71h2krjrb.us-east-1.rds.amazonaws.com", "phpmyadmin", "phpmyadmin", "Products");
  
  $Category = $_POST["Category"];
  
  //$sql_query = "select Product_Category from Products where Product_Category     like '$Category'";
  
  $sql_query = "select concat(Product_Owner_Email,'_',Product_Name,'_',     Product_Key_Code) as productkeyword from table where &lt;Product_Category like     '$Category'&gt;";
  
  $result = mysqli_query($conn, $sql_query);
  
  if(mysqli_num_rows($result) &gt; 0 ){
  
  $row = mysqli_fetch_assoc($result);
  $Product_Owner_Email =  $row['Product_Owner_Email'];
  $Product_Name =  $row['Product_Name'];
  $Product_Key_Code =  $row['Product_Key_Code'];
  
  }
  
  mysqli_close($conn);
  
  echo $ProductKeyWord;
  ?&gt;
  </code></pre>
  
  <p><strong>How can i concatenate 3 columns with MySQL in PHP?</strong></p>
  
  <p>also</p>
  
  <p><strong>On my app the echo back is ""</strong></p>
  
  <p>...................................................................... <strong>ANSWER BELOW</strong>............................................................</p>
  
  <pre><code>&lt;?php
  
   ini_set('display_errors',1); ini_set('display_startup_errors',1);   error_reporting(E_ALL);//This code is used so if i test the PHP in the browser itll tell me any errors or warnings!! 
  
   $conn = mysqli_connect("XXXX", "XXXX", "XXXX", "Products");
  
   $Category = $_POST["Category"];
  
   $sql = "SELECT Product_Owner_Email, Product_Name, Product_Key_Code FROM     Product_Details WHERE Product_Category LIKE '$Category'
   LIMIT 0 , 30";
   $result = $conn-&gt;query($sql);
  
   if ($result-&gt;num_rows &gt; 0) {
       // output data of each row
       while($row = $result-&gt;fetch_assoc()) {
           echo $row["Product_Owner_Email"]. "_" . $row["Product_Name"]. "_" .    $row["Product_Key_Code"] . " ";
       }
   } else {
       echo "0 results";
   }
   $conn-&gt;close();
   ?&gt;
  </code></pre>
  
  <blockquote>
    <p>the answer actually returns every "product" in the $Category</p>
  </blockquote>