title: Array search in mysql database with PHP
body: <p>There's a DB where I stored the products details. (id, name, price, category, unit)</p>
  
  <p>Firstly i'm listed the products for select in a php file named 'input.php'. It works like a charm.</p>
  
  <pre><code>// SQL query
  
      $query = "SELECT    * 
                FROM      products
                ORDER BY  p_name
                ASC";
  
              $result = mysql_query($query);
              if($result === FALSE) {die(mysql_error());}?&gt;
  
                  &lt;table width="100%"&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;/td&gt;
                          &lt;td width="800px"&gt;&lt;h1&gt;Product name&lt;/h1&gt;&lt;/td&gt;
                          &lt;td width="400px"&gt;&lt;h1&gt;Product price&lt;/h1&gt;&lt;/td&gt;
                          &lt;td&gt;Category&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
              &lt;?
              while ($row = mysql_fetch_assoc($result)) {?&gt;
                  &lt;table&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;input type="checkbox" name="pro_name[]" value="&lt;?=$row['p_name']?&gt;"&gt;&lt;/td&gt;
                          &lt;td width="800px" align="left"&gt;&lt;b&gt;&lt;?=$row['p_name']?&gt;&lt;/b&gt;&lt;/td&gt;
                          &lt;td width="400px" align="left"&gt;&lt;?=$row['p_price']?&gt;&lt;/td&gt;
                          &lt;td align="center"&gt;&lt;?=$row['p_cat']?&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
                  &lt;?}
  </code></pre>
  
  <p>I submit the data to 'index.php' and handle the variables in there.</p>
  
  <pre><code> if($_SERVER['REQUEST_METHOD']== "POST"){
  
  // Variables
  
  $c_name = $_POST['c_name'];             //  ['company name']
  $c_consumption = $_POST['c_consumption'];   //  ['company consumptions']
  $f_price = $_POST['f_price'];               //  ['fuel price']
  $o_sales = $_POST['o_sales'];               //  ['sales']
  $pro_name = $_POST['pro_name'];         //  ['products names']
  $pro_id = $_POST['pro_id'];             //  ['product id']  
  $pro_price = $_POST['pro_price'];           //  ['product price']
  </code></pre>
  
  <p>The third step where i'm stucked...I need to list the picked products details.</p>
  
  <p>My idea is to select the details from the db with search for the product names what i picked earlier.</p>
  
  <p>I tried it with IN, LIKE, implode....etc but it didn't work. :(</p>
  
  <pre><code>// SQL query
  
        $query = "SELECT  * 
                        FROM      products
                        WHERE     p_name IN (".implode(',', $pro_name).")
                        ORDER BY  p_name
                        ASC";
  
              $result = mysql_query($query);
              if($result === FALSE) {die(mysql_error());}
  
              while ($row = mysql_fetch_array($result)) {?&gt;
                  &lt;table&gt;
                      &lt;tr&gt;                            
                          &lt;td width="800px" align="left"&gt;&lt;b&gt;&lt;?=$row['p_name']?&gt;&lt;/b&gt;&lt;/td&gt;
                          &lt;td width="400px" align="left"&gt;&lt;?=$row['p_price']?&gt;&lt;/td&gt;
                          &lt;td align="center"&gt;&lt;?=$row['p_cat']?&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
                  &lt;?}
                  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <pre><code> var_dump($pro_name); result
  
   array(3) { [0]=&gt; string(14) "12 V szivattyú" [1]=&gt; string(17) "120 l/p szivattyú" [2]=&gt; string(28) "24 hónapra bővített garancia" } 
  </code></pre>