I am trying to create a php/html form which will insert results into
a dog show database. The problem no matter what I do I get this
error:
QUERY FAILED .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 'INSERT
INTO.
Here is the code for the page any help
appreciated.
data-hide="false" data-console="true" data-babel="false">
class="snippet-code">
if(isset($_POST['create_show'])) {
//Insert Judges
$show_title = escape($_POST['show_title']);
$show_user =
escape($_POST['show_user']);
$show_category_id =
escape($_POST['show_category_id']);
$show_status =
escape($_POST['show_status']);
// $show_image =
escape($_FILES['show_image']['name']);
//$show_image_temp =
escape($_FILES['image']['tmp_name']);
$show_tags =
escape($_POST['show_tags']);
$show_content =
escape($_POST['show_content']);
//$show_date =
escape(date('d-m-y'));
//INSERT Judges
$judge_affix =
escape($_POST['judge_affix']);
$judge_name =
escape($_POST['judge_name']);
$judge_show =
escape($_POST['show_idj']);
//Insert Dogs
$dog_name =
escape($_POST['dog_name']);
$resultIDD =
escape($_POST['resultIDD']);
//Insert Into Results
$class_name =
escape($_POST['class_name']);
$placement =
escape($_POST['placement']);
$award =
escape($_POST['award']);
//move_uploaded_file($show_image_temp, "../images/$show_image" );
//Insert Shows
$query = "INSERT INTO shows (show_category_id,
show_title, show_user, show_content, show_tags, show_status) VALUES
('$show_category_id','$show_title','$show_user','$show_content','$show_tags','$show_status');";
$query
.= "INSERT INTO judges (judge_affix, judge_name) VALUES
('$judge_affix','$judge_name');";
$query .= "INSERT INTO dogs (dog_name,
resultIDD) VALUES ('$dog_name','$resultIDD');";
$query .= "INSERT INTO
result(class_name, placement,) VALUES ('$class_name','$placement')";
$create_show_query = mysqli_query($connection, $query);
confirmQuery($create_show_query);
$the_show_id =
mysqli_insert_id($connection);
echo " class='bg-success'>Show Created. View
Post or Edit More
Shows";
}
?>
method="post" enctype="multipart/form-data">
class="form-group">
name="show_title">
class="form-group">
for="category">Category
id="">
$query = "SELECT * FROM
categories";
$select_categories =
mysqli_query($connection,$query);
confirmQuery($select_categories);
while($row
= mysqli_fetch_assoc($select_categories )) {
$cat_id =
$row['cat_id'];
$cat_title = $row['cat_title'];
echo "";
}
?>
No comments:
Post a Comment