I keep getting an the following error of Array to string conversion error on this line listed below. How can I fix this problem?
$skill = explode('', $_POST['skill']);
Here is the PHP & MySQL code.
$skill = explode('', $_POST['skill']);
$experience = explode('', $_POST['experience']);
$years = explode('', $_POST['years']);
for ($s = 0; $s < count($skill); $s++){
for ($x = 0; $x < count($experience); $x++){
for ($g = 0; $g < 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 '<p class="changes-saved">Your changes have been saved!</p>';
}
if (!$dbc) {
print mysqli_error($mysqli);
return;
}
}
}
}