I keep getting the error listed below but it only says line 1 what does this mean and how do I fix it?
Here is the error I keep getting?
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1
here is the code.
if (isset($_POST['info_submitted'])) {
$user_id = '5';
$mysqli = mysqli_connect("localhost", "root", "", "sitename");
$dbc = mysqli_query($mysqli,"SELECT learned_skills.*, users_skills.*
FROM learned_skills
INNER JOIN users_skills ON learned_skills.id = users_skills.skill_id
WHERE user_id='$user_id'");
$skill = $_POST['skill'];
$experience = $_POST['experience'];
$year = $_POST['year'];
if (mysqli_num_rows($dbc) == 0) {
$mysqli = mysqli_connect("localhost", "root", "", "sitename");
$query1 = mysqli_query($mysqli,"INSERT INTO learned_skills (skill, experience, year)
VALUES ('" . $skill . "', '" . $experience . "', '" . $year . "')");
}
if (!mysqli_query($mysqli, $query1)) {
print mysqli_error($mysqli);
return;
}
$mysqli = mysqli_connect("localhost", "root", "", "sitename");
$dbc = mysqli_query($mysqli,"SELECT id
FROM learned_skills
WHERE id='" . $skill . "'
AND experience='" . $experience . "'
AND year='" . $year . "'");
if (!$dbc) {
print mysqli_error($mysqli);
} else {
while($row = mysqli_fetch_array($dbc)){
$id = $row["id"];
}
}
$query2 = "INSERT INTO users_skills (skill_id, user_id, date_created) VALUES ('$id', '$user_id', NOW())";
if (!mysqli_query($mysqli, $query2)) {
print mysqli_error($mysqli);
return;
}
if ($dbc == TRUE) {
$dbc = mysqli_query($mysqli,"UPDATE learned_skills
JOIN users_skills
ON (users_skills.skill_id = learned_skills.id)
SET skill = '$skill', experience = '$experience', year = '$year'");
echo '<p class="changes-saved">Your changes have been saved!</p>';
}
if (!$dbc) {
print mysqli_error($mysqli);
return;
}
}