title: PHP & MySQL - Array to string conversion error problem
body: <p>I keep getting an the following error of <code>Array to string conversion error</code> on this line listed below. How can I fix this problem?</p>
  
  <pre><code>$skill = explode('', $_POST['skill']);
  </code></pre>
  
  <p>Here is the PHP &amp; MySQL code.</p>
  
  <pre><code>$skill = explode('', $_POST['skill']);
  $experience = explode('', $_POST['experience']);
  $years = explode('', $_POST['years']);
  
  for ($s = 0; $s &lt; count($skill); $s++){
      for ($x = 0; $x &lt; count($experience); $x++){
          for ($g = 0; $g &lt; count($years); $g++){
  
              if (mysqli_num_rows($dbc) == 0) {
                      $mysqli = mysqli_connect("localhost", "root", "", "sitename");
                      $dbc = mysqli_query($mysqli,"INSERT INTO learned_skills (user_id, skill, experience, years, date_created) 
                                                   VALUES ('" . $user_id . "', '" . $skill[$s] . "', '" . $experience[$x] . "', '" . $years[$g] . "', NOW())");
              }
  
              if ($dbc == TRUE) {
                      $dbc = mysqli_query($mysqli,"UPDATE learned_skills 
                                                   SET skill = '$skill', experience = '$experience', years = '$years', date_created = NOW()
                                                   WHERE user_id = '$user_id'");
  
                      echo '&lt;p class="changes-saved"&gt;Your changes have been saved!&lt;/p&gt;';
              }
  
              if (!$dbc) {
                      print mysqli_error($mysqli);
                      return;
              }
  
          }
      }
  }
  </code></pre>
  
  <p>Here is the HTML code.</p>
  
  <pre><code>&lt;li&gt;&lt;label for="skill"&gt;Skills: &lt;/label&gt;&lt;input type="text" name="skill[]" id="skill[]" size="25" maxlength="255" /&gt;
  &lt;label for="experience"&gt;Experience: &lt;/label&gt;
  &lt;?php
  
  echo '&lt;select id="experience[]" name="experience[]"&gt;' . "\n";
    foreach($experience_options as $option) {
      if ($option == $experience) {
        echo '&lt;option value="' . stripslashes(htmlentities(strip_tags($option))) . '" selected="selected"&gt;' . stripslashes(htmlentities(strip_tags($option))) . '&lt;/option&gt;' . "\n";
      } else {
        echo '&lt;option value="'. stripslashes(htmlentities(strip_tags($option))) . '"&gt;' . stripslashes(htmlentities(strip_tags($option))) . '&lt;/option&gt;'."\n";
      }
    }
  echo '&lt;/select&gt;';
  
  ?&gt;
  &lt;label for="years"&gt;Years: &lt;/label&gt;
  &lt;?php
  
  echo '&lt;select id="years[]" name="years[]"&gt;' . "\n";
    foreach($year_options as $option) {
      if ($option == $years) {
        echo '&lt;option value="' . stripslashes(htmlentities(strip_tags($option))) . '" selected="selected"&gt;' . stripslashes(htmlentities(strip_tags($option))) . '&lt;/option&gt;' . "\n";
      } else {
        echo '&lt;option value="'. stripslashes(htmlentities(strip_tags($option))) . '"&gt;' . stripslashes(htmlentities(strip_tags($option))) . '&lt;/option&gt;'."\n";
      }
    }
  echo '&lt;/select&gt;&lt;/li&gt;';
  </code></pre>