title: insert multiple checkbox values into mysql field but add space between each one?
body: <p>i am allowing my user to insert either one or 4 checkbox values into one field in my database, and later on want to be able to retrieve this data by doing a query for the each of those words, however, when more than one value is inserted into my field it separates these with a comma, which is fine but how do i seperate the words with a space? so i can later on do a search in my query for values containing 'mechanical' or 'non_mechanical' etc.</p>
  
  <p>heres how it is being stored</p>
  
  <pre><code>mechanical,non_mechanical
  </code></pre>
  
  <p>also would the comma stop me doing a query for all containing the value of 'mechanical' for example as it would have a comma on the end?</p>
  
  <p>html:</p>
  
  <pre><code>&lt;p&gt;mechanical&lt;/p&gt;
  &lt;input type="checkbox" id="box1" name="scope_type[]" value="mechanical" onClick="showMore(this);"&gt;
  
  
  &lt;p&gt;Non-Mechanical Hire&lt;/p&gt;
  &lt;input type="checkbox" id="box1" name="scope_type[]" value="non_mechanical" onClick="showMoreMore(this);"&gt;
  
  
  &lt;p&gt;Tools&lt;/p&gt;
  &lt;input type="checkbox" id="box1" name="scope_type[]" value="tools"  onClick="showMoreMoreMore(this);"&gt;
  
  &lt;p&gt;Accessories&lt;/p&gt;
  &lt;input type="checkbox" id="box1" name="scope_type[]" value="accessories"  onClick="showMoreMoreMoreMore(this);"&gt;
  </code></pre>
  
  <p>mysql:</p>
  
  <pre><code>&lt;?php
  session_start();
  
  $db_hostname = 'localhost';
  $db_database = 'xxxx'; 
  $db_username = 'xxxx';
  $db_password = 'xxxx';
  
  $db_server = mysql_connect($db_hostname, $db_username, $db_password)    
          or die("Unable to connect to MySQL: " . mysql_error());
  
  mysql_select_db($db_database)   
  or die("Unable to select database: " . mysql_error());
  
   $scope_type = implode(",",$_POST["scope_type"]);
  
      $ipaddress = $_SERVER["REMOTE_ADDR"];
  
  
  
  
  $sql="INSERT INTO supplier_scope (user_ip, scope_type)
      VALUES ('$ipaddress', '$scope_type')";  
  
  $result = mysql_query($sql); 
  
  $sql2="UPDATE supplier_session SET form2_completed = 'Yes' WHERE form2_completed = 'No' AND user_IP = '$ipaddress'";
  
  $result2 = mysql_query($sql2); 
  
  
   if($result){
  
      header("Location: index.php?registration=success");
  
  }else {
  echo "ERROR";
  }
  ?&gt;
  </code></pre>