Hoqueries无法正常工作.insert查询工作正常,但其他三个查询无法正常工作它发生了错误我是... [英] Hoqueries are not work properly .insert query is work fine but other three queries are not working it was occurred errorsw do I...
本文介绍了Hoqueries无法正常工作.insert查询工作正常,但其他三个查询无法正常工作它发生了错误我是...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I was create a form with four buttons such as submit,update,delete and search.insert query is work fine but other three queries are not working it was occurred errors.
update
Error: UPDATE FROM course_details,personal_details,contact_details,academic_details,extra_curricular_activities WHERE course_details.Student_ID =personal_details.Student_ID AND course_details.Student_ID =contact_details.Student_ID AND course_details.Student_ID =academic_details.Student_ID AND course_details.Student_ID =extra_curricular_activities.Student_ID AND Student_ID=IM/20xx/002 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM course_details,personal_details,contact_details,academic_details,extra_curr' at line 1
search
error: result error
delete
Error: DELETE FROM course_details,personal_details,contact_details,academic_details,extra_curricular_activities WHERE course_details.Student_ID =personal_details.Student_ID AND course_details.Student_ID =contact_details.Student_ID AND course_details.Student_ID =academic_details.Student_ID AND course_details.Student_ID =extra_curricular_activities.Student_ID AND Student_ID=IM/20xx/002 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE course_details.Student_ID =personal_details.Student_ID AND course_det' at line 1
Here is my files
What I have tried:
Form.css
<pre>*
{
padding: 0;
margin: 0;
border: 0;
}
body, html {
color: #373C40;
font-family: Verdana,Arial, Helvetica, sans-serif;
height: 100%;
background-color: #f0f0f0;
margin:10px;
}
body {
font-size: 70%;
}
p {
padding: 7px 0 7px 0;
font-weight: 500;
font-size: 10pt;
}
h1 {
font-weight:200;
color: #888888;
font-size:16pt;
background: transparent url(img/h1.png) no-repeat center left;
padding-left:33px;
margin:7px 5px 8px 8px;
}
h4 {
padding:1px;
color: #ACACAC;
font-size:11pt;
font-weight:100;
text-transform:unset;
}
form.profile{
width:900px;
margin: 20px auto 20px auto;
height:1600px;
background-color:#fff;
padding:5px;
-moz-border-radius:20px;
-webkit-border-radius:20px;
}
form p{
font-size: 8pt;
clear:both;
margin: 0;
color:gray;
padding:4px;
}
form.profile fieldset.row1
{
width:450px;
padding:5px;
height:250px;
float:left;
border-top:1px solid #F5F5F5;
border-right:1px solid #F1F1F1;
margin-bottom:15px;
margin-bottom:15px;
}
form.profile fieldset.row1 label{
width:100px;
float: left;
text-align: left;
margin-right: 6px;
margin-top:2px;
}
form.profile fieldset.row3 label,
form.profile fieldset.row4 label
{
width:160px;
float: left;
text-align: center;
margin-right: 6px;
margin-top:2px;
}
form.profile fieldset.row2
{
border-top:1px solid #F1F1F1;
height:250px;
width:400px;
padding:5px;
float:left;
margin-bottom:15px;
}
form.profile fieldset.row3
{
border-top:1px solid #F1F1F1;
padding:5px;
float:left;
margin-bottom:15px;
width:870px;
}
form.profile fieldset.row4
{
border-top:1px solid #F1F1F1;
padding:5px;
float:left;
width:870px;
}
form.profile fieldset.row5
{
border-top:1px solid #F1F1F1;
padding:5px;
float:left;
width:870px;
}
form.profiler table
{
align:center;
}
form.profile legend
{
color: #abda0f;
padding:2px;
margin-left: 14px;
font-weight:bold;
font-size: 16px;
font-weight:100;
}
form.profile label{
color:#444;
width:120px;
float: left;
text-align: left;
margin-right: 6px;
margin-top:2px;
}
form.profile input{
width: 140px;
color: #505050;
float: left;
margin-right: 5px;
}
form.profile input.long{
width: 247px;
color: #505050;
}
form.profile input.course{
width: 270px;
color: #505050;
}
form.profile input.subject{
width: 200px;
color: #505050;
}
form.profile input.short{
width: 40px;
color: #505050;
}
form.profile input[type=radio]
{
float:left;
width:15px;
}
form.profile input[type=image]
{
width:200px;
height: 200px;
}
form.profile label.gender{
margin-top:-1px;
margin-bottom:2px;
width:34px;
float:left;
text-align:left;
line-height:19px;
}
form.profile input[type=text],
form.profile input[type=date]
{
border: 1px solid #E1E1E1;
height: 18px;
}
form.profile textarea.extra{
width: 247px;
color: #505050;
height: 100px;
border-color: 1px solid #E1E1E1;
}
.button
{
background: #abda0f url(img/overlay.png) repeat-x;
padding: 8px 10px 8px;
color: #fff;
text-decoration: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
cursor: pointer;
float:left;
font-size:18px;
margin:10px;
}
form.profile input[type=text].year
{
border: 1px solid #E1E1E1;
height: 18px;
width:30px;
}
form.profile select
{
border: 1px solid #E1E1E1;
width: 130px;
float:left;
margin-bottom:3px;
color: #505050;
margin-right:5px;
}
form.profile select.result
{
width: 40px;
}
input:focus, select:focus{
background-color: #efffe0;
}
index.php
index.php
<?Php
include "Form.php";
?>
<!DOCTYPE html>
<html >
<head>
<title>Student Information Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="Form.css"/>
</head>
<body>
<form method="post" action="Form.php" class="profile">
<h1>Create Profile</h1>
<fieldset class="row1">
<legend>Course Details</legend>
<table >
<tr >
<td rowspan="3">
<input type="image" name="profile_picture" value="<?php echo($profile_picture);?>" id="profile_picture" />
</td>
<td>
<p>
<label>Student ID *</label>
<input type="text" value="<?php echo($student_id);?>IM/20xx/xxx" name="student_id" id="student_id" />
</p>
</td>
</tr>
<tr>
<td>
<p>
<label>Admitted Date *</label>
<input type="date" name="admitted_date" value="<?php echo($admitted_date);?>" id="admitted_date" />
</p>
</td>
</tr>
<tr>
<td>
<p>
<label>Academic Year*</label>
<input type="text" name="academic_year" value="<?php echo($academic_year);?>" id="academic_year" />
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
<label>Course*</label>
<input type = "text" name = "course" id="course" value="<?php echo($course);?>Bsc.in Management Information Technology" class="course"/>
</p>
</td>
</tr>
</table>
</fieldset>
<fieldset class="row2">
<legend>Personal Details</legend>
<p>
<label>First Name *</label>
<input type="text" name="first_name" id="first_name" value="<?php echo($first_name);?>" class="long"/>
</p>
<p>
<label>Middle Name *</label>
<input type="text" name="middle_name" id="middle_name" value="<?php echo($middle_name);?>" class="long"/>
</p>
<p>
<label>Last Name *</label>
<input type="text" name="last_name" id="last_name" value="<?php echo($last_name);?>" class="long"/>
</p>
<p>
<label>Date of Birth *</label>
<input type="date" name="dob" id="dob" value="<?php echo($dob);?>"/>
</p>
<p>
<label>Gender *</label>
<input type="radio" name= "gender" id="male" value="<?php echo($gender);?>Male"/>
<label class="gender">Male</label>
<input type="radio" name= "gender" id="female" value="<?php echo($gender);?>Female"/>
<label class="gender">Female</label>
</p>
<p>
<label>NIC Number *</label>
<input type="text" name="nic" value="<?php echo($nic);?>" id="nic" maxlength="10"/>
</p>
<p>
<label>Nationality *</label>
<select name="nationality" value="<?php echo($nationality);?>" id="nationality">
<option>--Select--</option>
<option value="Sri Lankan">Sri Lankan</option>
<option value="Other">Other</option>
</select>
</p>
<p>
<label >Religion</label>
<select name="religion" value="<?php echo($religion);?>" id="religion">
<option value="">--Select--</option>
<option value="Buddism">Buddism</option>
<option value="Hindu">Hindu</option>
<option value="Islam">Islam</option>
<option value="Christian">Christian</option>
<option value="Other">Other</option>
</select>
</p>
<p>
<label >Race</label>
<select name="race" value="<?php echo($race);?>" id="race">
<option value="">--Select--</option>
<option value="Sinhala">Sinhala</option>
<option value="Tamil">Hindu</option>
<option value="Muslim">Muslim</option>
<option value="Burger">Burger</option>
<option value="Other">Other</option>
</select>
</p>
</fieldset>
<fieldset class="row3">
<legend>Contact Details</legend>
<table >
<tr>
<th><h4> Permanent Address</h4></th>
<th><h4> Temporary Address</h4></th>
</tr>
<tr>
<td>
<p>
<label>Address Line 1 </label>
<input type="text" name="p_add_line1" id="p_add_line1" value="<?php echo($p_add_line1);?>" class="long"/>
</p>
</td>
<td>
<p>
<label>Address Line 1 </label>
<input type="text" name="t_add_line1" id="t_add_line1" value="<?php echo($t_add_line1);?>" class="long"/>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label>Address Line 2</label>
<input type="text" name="p_add_line2" id="p_add_line2" value="<?php echo($p_add_line2);?>" class="long"/>
</p>
</td>
<td>
<p>
<label>Address Line 2</label>
<input type="text" name="t_add_line2" id="t_add_line2" value="<?php echo($t_add_line2);?>" class="long"/>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label>Address Line 3</label>
<input type="text" name="p_add_line3" id="p_add_line3" value="<?php echo($p_add_line3);?>" class="long"/>
</p>
</td>
<td>
<p>
<label>Address Line 3</label>
<input type="text" name="t_add_line3" id="t_add_line3" value="<?php echo($t_add_line3);?>" class="long"/>
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
<label >City</label>
<input type = "text" class="long" name="city" value="<?php echo($city);?>" id="city" />
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
<label >Email Address</label>
<input type = "text" name="email" id="email" class="long" value="<?php echo($email);?>" value="abc@gmail.com" />
</p>
</td>
</tr>
<tr>
<th><h4>Student's Contact Number</h4></th>
<th><h4>Parent's Contact Number</h4></th>
</tr>
<tr>
<td>
<p>
<label >Home</label>
<input type = "text" name="stu_con_home" id="stu_con_home" value="<?php echo($stu_con_home);?>" maxlength="10" />
</p>
</td>
<td>
<p>
<label >Home</label>
<input type = "text" name="p_con_home" id="p_con_home" value="<?php echo($p_con_home);?>" maxlength="10" />
</p>
</td>
</tr>
<tr>
<td>
<p>
<label >Mobile 1</label>
<input type = "text" name="stu_con_mobile1" id="stu_con_mobile1" value="<?php echo($stu_con_mobile1);?>" maxlength="10" />
</p>
</td>
<td>
<p>
<label >Mobile 1</label>
<input type = "text" name="p_con_mobile1" id="p_con_mobile1" value="<?php echo($p_con_mobile1);?>" maxlength="10" />
</p>
</td>
</tr>
<tr>
<td>
<p>
<label >Mobile 2</label>
<input type = "text" name="stu_con_mobile2" id="stu_con_mobile2" value="<?php echo($stu_con_mobile2);?>" maxlength="10" />
</p>
</td>
<td>
<p>
<label >Mobile 2</label>
<input type = "text" name="p_con_mobile2" id="p_con_mobile2" value="<?php echo($p_con_mobile2);?>" maxlength="10" />
</p>
</td>
</tr>
</table>
</fieldset>
<fieldset class="row4">
<legend>Academic Details</legend>
<table >
<tr>
<th><h4>O/L Results</h4></th>
<th><h4>A/L Results</h4></th>
</tr>
<tr>
<td>
<p>
<input type = "text" name = "o_admi_no" id="o_admi_no" placeholder = "Admition Number" value="<?php echo($o_admi_no);?>"/>
<input type = "text" name = "o_year" id="o_year" placeholder = "Year" value="<?php echo($o_year);?>" />
</p>
</td>
<td>
<p>
<input type = "text" name = "a_admi_no" id="a_admi_no" placeholder = "Admition Number" value="<?php echo($a_admi_no);?>"/>
<input type = "text" name = "a_year" id="a_year" placeholder = "Year" value="<?php echo($a_year);?>" />
</p>
</td>
</tr>
<tr>
<td>
<p>
<label >Subject 1</label>
<input type = "text" name = "o_subject1" id="o_subject1" value="<?php echo($o_subject1);?>Mathematics" class="subject"/>
<select name="o_grade1" id="o_grade1" value="<?php echo($o_grade1);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
<td>
<p>
<label >Subject 1</label>
<input type = "text" name = "a_subject1" id="a_subject1" value="<?php echo($a_subject1);?>" class="subject" />
<select name="a_grade1" id="a_grade1" value="<?php echo($a_grade1);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label >Subject 2</label>
<input type = "text" name = "o_subject2" id="o_subject2" value="<?php echo($o_subject2);?>Science" class="subject"/>
<select name="o_grade2" id="o_grade2" value="<?php echo($o_grade2);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
<td>
<p>
<label >Subject 2</label>
<input type = "text" name = "a_subject2" value="<?php echo($a_subject2);?>" id="a_subject2" class="subject" />
<select name="a_grade2" id="a_grade2" value="<?php echo($a_grade2);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label >Subject 3</label>
<input type = "text" name = "o_subject3" id="o_subject3" value="<?php echo($o_subject3);?>Sinhala" class="subject"/>
<select name="o_grade3" id="o_grade3" value="<?php echo($o_grade3);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
<td>
<p>
<label >Subject 3</label>
<input type = "text" name = "a_subject3" value="<?php echo($a_subject3);?>" id="a_subject3" class="subject" />
<select name="a_grade3" id="a_grade3" value="<?php echo($a_grade3);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label >Subject 4</label>
<input type = "text" name = "o_subject4" id="o_subject4" value="<?php echo($o_subject4);?>English" class="subject"/>
<select name="o_grade4" id="o_grade4" value="<?php echo($o_grade4);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
<td>
<p>
<label >Subject 4</label>
<input type = "text" name = "a_subject4" id="a_subject4" value="<?php echo($a_subject4);?>General English" class="subject"/>
<select name="a_grade4" id="a_grade4" value="<?php echo($a_grade4);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label >Subject 5</label>
<input type = "text" name = "o_subject5" id="o_subject5" value="<?php echo($o_subject5);?>Religion" class="subject"/>
<select name="o_grade5" id="o_grade5" value="<?php echo($o_grade5);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
<td>
<p>
<label >Z-Score</label>
<input type = "text" name = "z_score" id="z_score" value="<?php echo($z_score);?>" />
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
<label >Subject 6</label>
<input type = "text" name = "o_subject6" id="o_subject6" value="<?php echo($o_subject6);?>History" class="subject"/>
<select name="o_grade6" id="o_grade6" value="<?php echo($o_grade6);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
<label >Subject 7</label>
<input type = "text" name = "o_subject7" id="o_subject7" value="<?php echo($o_subject7);?>" placeholder = "Group Subject 1" class="subject" />
<select name="o_grade7" id="o_grade7" value="<?php echo($o_grade7);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
<label >Subject 8</label>
<input type = "text" name = "o_subject8" id="o_subject8" value="<?php echo($o_subject8);?>" placeholder = "Group Subject 2" class="subject" />
<select name="o_grade8" id="o_grade8" value="<?php echo($o_grade8);?>" class="result">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
<label >Subject 9</label>
<input type = "text" name = "o_subject9" id="o_subject9" value="<?php echo($o_subject9);?>" placeholder = "Group Subject 3" class="subject"/>
<select class="result" name="o_grade9" value="<?php echo($o_grade9);?>" id="o_grade9">
<option value=""></option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="S">S</option>
<option value="F">F</option>
</select>
</p>
</td>
</tr>
</table>
</fieldset>
</fieldset>
<fieldset class="row5">
<legend>Extra Curricular Activities</legend>
<table >
<tr>
<th colspan="2"><h4>Extra Curricular Activities</h4></th>
</tr>
<tr>
<td>
<p>
<label for="School Level">School Level:</label>
<textarea name="school_level" id="school_level" value="<?php echo($school_level);?>" placeholder="School Level" class="extra"></textarea>
</p>
</td>
<td>
<p>
<label for="Zonal Level">Zonal Level:</label>
<textarea name="zonal_level" id="zonal_level" value="<?php echo($zonal_level);?>" placeholder="Zonal Level" class="extra"></textarea>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label for="District Level">District Level:</label>
<textarea name="district_level" id="district_level" value="<?php echo($district_level);?>" placeholder="District Level" class="extra"></textarea>
</p>
</td>
<td>
<p>
<label for="Provincial Level">Provincial Level:</label>
<textarea name="provincial_level" id="provincial_level" value="<?php echo($provincial_level);?>" placeholder="Provincial Level" class="extra"></textarea>
</p>
</td>
</tr>
<tr>
<td>
<p>
<label for="National Level">National Level:</label>
<textarea name="national_level" id="national_level" value="<?php echo($national_level);?>" placeholder="National Level" class="extra"></textarea>
</p>
</td>
<td>
<p>
<label for="International Level">International Level:</label>
<textarea name="international_level" id="international_level" value="<?php echo($international_level);?>" placeholder="International Level" class="extra"></textarea>
</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>
<h4>Current Activities</h4>
<textarea name="current_activities" id="current_activities" value="<?php echo($current_activities);?>" placeholder="Current Activities" class="extra"></textarea>
</p>
</td>
</tr>
</table>
</fieldset>
<div><button class="button" name="add">Submit »</button></div>
<div><button class="button" name="update">Update »</button></div>
<div><button class="button" name="delete">Delete »</button></div>
<div><button class="button" name="search">Search »</button></div>
</form>
</body>
</html>
Form.php
Form.php
<?php
$profile_picture=$_POST['profile_picture'];//define variables
$student_id=$_POST['student_id'];
$admitted_date=$_POST['admitted_date'];
$academic_year=$_POST['academic_year'];
$course=$_POST['course'];
$first_name=$_POST['first_name'];//define variables
$middle_name=$_POST['middle_name'];
$last_name=$_POST['last_name'];
$dob=$_POST['dob'];
$gender=$_POST['gender'];
$nic=$_POST['nic'];
$nationality=$_POST['nationality'];
$religion=$_POST['religion'];
$race=$_POST['race'];
$p_add_line1=$_POST['p_add_line1'];//define variables
$p_add_line2=$_POST['p_add_line2'];
$p_add_line3=$_POST['p_add_line3'];
$city=$_POST['city'];
$email=$_POST['email'];
$t_add_line1=$_POST['t_add_line1'];
$t_add_line2=$_POST['t_add_line2'];
$t_add_line3=$_POST['t_add_line3'];
$stu_con_home=$_POST['stu_con_home'];
$stu_con_mobile1=$_POST['stu_con_mobile1'];
$stu_con_mobile2=$_POST['stu_con_mobile2'];
$p_con_home=$_POST['p_con_home'];
$p_con_mobile1=$_POST['p_con_mobile1'];
$p_con_mobile2=$_POST['p_con_mobile2'];
$o_admi_no=$_POST['o_admi_no'];//define variables
$o_year=$_POST['o_year'];
$o_subject1=$_POST['o_subject1'];
$o_grade1=$_POST['o_grade1'];
$o_subject2=$_POST['o_subject2'];
$o_grade2=$_POST['o_grade2'];
$o_subject3=$_POST['o_subject3'];
$o_grade3=$_POST['o_grade3'];
$o_subject4=$_POST['o_subject4'];
$o_grade4=$_POST['o_grade4'];
$o_subject5=$_POST['o_subject5'];
$o_grade5=$_POST['o_grade5'];
$o_subject6=$_POST['o_subject6'];
$o_grade6=$_POST['o_grade6'];
$o_subject7=$_POST['o_subject7'];
$o_grade7=$_POST['o_grade7'];
$o_subject8=$_POST['o_subject8'];
$o_grade8=$_POST['o_grade8'];
$o_subject9=$_POST['o_subject9'];
$o_grade9=$_POST['o_grade9'];
$a_admi_no=$_POST['a_admi_no'];//define variables
$a_year=$_POST['a_year'];
$a_subject1=$_POST['a_subject1'];
$a_grade1=$_POST['a_grade1'];
$a_subject2=$_POST['a_subject2'];
$a_grade2=$_POST['a_grade2'];
$a_subject3=$_POST['a_subject3'];
$a_grade3=$_POST['a_grade3'];
$a_subject4=$_POST['a_subject4'];
$a_grade4=$_POST['a_grade4'];
$z_score=$_POST['z_score'];
$school_level=$_POST['school_level'];//define variables
$zonal_level=$_POST['zonal_level'];
$district_level=$_POST['district_level'];
$provincial_level=$_POST['provincial_level'];
$national_level=$_POST['national_level'];
$international_level=$_POST['international_level'];
$current_activities=$_POST['current_activities'];
$connection = new mysqli("localhost","root","","student_information");//create connection
//Test Connection
if ($connection->connect_error) {
die("Connection Failed :".$connection->connect_error);
}
//Create insert query
if (isset($_POST['add'])) {
$sql = "INSERT INTO course_details (Student_ID,Admitted_Date,Academic_Year,Course,Profile_Picture)
VALUES ('$student_id','$admitted_date','$academic_year','$course','$profile_picture');";
$sql .= "INSERT INTO personal_details (Student_ID,First_Name,Middle_Name,Last_Name,DOB,Gender,NIC,Nationality,Religion,Race)
VALUES ('$student_id','$first_name','$middle_name','$last_name','$dob','$gender','$nic','$nationality','$religion','$race');";
$sql .= "INSERT INTO contact_details (Student_ID,P_Add_Line1,P_Add_Line2,P_Add_Line3,City,Email,T_Add_Line1,T_Add_Line2,T_Add_Line3,stu_con_home,Stu_Con_Mobile1,Stu_Con_Mobile2,P_Con_Home,P_Con_Mobile1,P_Con_Mobile2)
VALUES ('$student_id','$p_add_line1','$p_add_line2','$p_add_line3','$city','$email','$t_add_line1','$t_add_line2','$t_add_line3','$stu_con_home','$stu_con_mobile1','$stu_con_mobile2','$p_con_home','$p_con_mobile1','$p_con_mobile2');";
$sql .= "INSERT INTO academic_details (Student_ID,O_Admi_No,O_Year,O_Subject1,O_Grade1,O_Subject2,O_Grade2,O_Subject3,O_Grade3,O_Subject4,O_Grade4,O_Subject5,O_Grade5,O_Subject6,O_Grade6,O_Subject7,O_Grade7,O_Subject8,O_Grade8,O_Subject9,O_Grade9,A_Admi_No,A_Year,A_Subject1,A_Grade1,A_Subject2,A_Grade2,A_Subject3,A_Grade3,A_Subject4,A_Grade4,Z_Score)
VALUES ('$student_id','$o_admi_no','$o_year','$o_subject1','$o_grade1','$o_subject2','$o_grade2','$o_subject3','$o_grade3','$o_subject4','$o_grade4','$o_subject5','$o_grade5','$o_subject6','$o_grade6','$o_subject7','$o_grade7','$o_subject8','$o_grade8','$o_subject9','$o_grade9','$a_admi_no','$a_year','$a_subject1','$a_grade1','$a_subject2','$a_grade2','$a_subject3','$a_grade3','$a_subject4','$a_grade4','$z_score');";
$sql .= "INSERT INTO extra_curricular_activities (Student_ID,School_Level,Zonal_Level,District_Level,Provincial_Level,National_Level,International_Level,Current_Activities)
VALUES ('$student_id','$school_level','$zonal_level','$district_level','$provincial_level','$national_level','$international_level','$current_activities')";
//Test insert query
if ($connection->multi_query($sql) === TRUE) {
echo "Submitted Successsfully";
} else {
echo "Error: " . $sql . "<br>" . $connection->error;
}
}
//create update query
if (isset($_POST['update'])) {
$sql ="UPDATE FROM course_details,personal_details,contact_details,academic_details,extra_curricular_activities WHERE course_details.Student_ID =personal_details.Student_ID AND
course_details.Student_ID =contact_details.Student_ID AND
course_details.Student_ID =academic_details.Student_ID AND
course_details.Student_ID =extra_curricular_activities.Student_ID AND Student_ID=$student_id";
if ($connection->multi_query($sql) === TRUE) {
echo "Updated Successsfully";
} else {
echo "Error: " . $sql . "<br>" . $connection->error;
}
}
//create delete query
if (isset($_POST['delete'])) {
$sql ="DELETE FROM course_details,personal_details,contact_details,academic_details,extra_curricular_activities WHERE course_details.Student_ID =personal_details.Student_ID AND
course_details.Student_ID =contact_details.Student_ID AND
course_details.Student_ID =academic_details.Student_ID AND
course_details.Student_ID =extra_curricular_activities.Student_ID AND Student_ID=$student_id";
if ($connection->multi_query($sql) === TRUE) {
echo "Deleted Successsfully";
} else {
echo "Error: " . $sql . "<br>" . $connection->error;
}
}
//create search query
if (isset($_POST['search'])) {
$sql ="SELECT course_details.*,personal_details.*,contact_details.*,academic_details.*,extra_curricular_activities.* FROM course_details,personal_details,contact_details,academic_details,extra_curricular_activities WHERE course_details.Student_ID =personal_details.Student_ID AND
course_details.Student_ID =contact_details.Student_ID AND
course_details.Student_ID =academic_details.Student_ID AND
course_details.Student_ID =extra_curricular_activities.Student_ID AND Student_ID=$student_id";
$result = mysqli_query($connection,$sql);
if ($result)
{
if (mysqli_num_rows($result))
{
while($rows=mysqli_fetch_array($result))
{
$profile_picture=$rows['profile_picture'];
$student_id=$rows['student_id'];
$admitted_date=$rows['admitted_date'];
$academic_year=$rows['academic_year'];
$course=$rows['course'];
$first_name=$rows['first_name'];
$middle_name=$rows['middle_name'];
$last_name=$rows['last_name'];
$dob=$rows['dob'];
$gender=$rows['gender'];
$nic=$rows['nic'];
$nationality=$rows['nationality'];
$religion=$rows['religion'];
$race=$rows['race'];
$p_add_line1=$rows['p_add_line1'];
$p_add_line2=$rows['p_add_line2'];
$p_add_line3=$rows['p_add_line3'];
$city=$rows['city'];
$email=$rows['email'];
$t_add_line1=$rows['t_add_line1'];
$t_add_line2=$rows['t_add_line2'];
$t_add_line3=$rows['t_add_line3'];
$stu_con_home=$rows['stu_con_home'];
$stu_con_mobile1=$rows['stu_con_mobile1'];
$stu_con_mobile2=$rows['stu_con_mobile2'];
$p_con_home=$rows['p_con_home'];
$p_con_mobile1=$rows['p_con_mobile1'];
$p_con_mobile2=$rows['p_con_mobile2'];
$o_admi_no=$rows['o_admi_no'];
$o_year=$rows['o_year'];
$o_subject1=$rows['o_subject1'];
$o_grade1=$rows['o_grade1'];
$o_subject2=$rows['o_subject2'];
$o_grade2=$rows['o_grade2'];
$o_subject3=$rows['o_subject3'];
$o_grade3=$rows['o_grade3'];
$o_subject4=$rows['o_subject4'];
$o_grade4=$rows['o_grade4'];
$o_subject5=$rows['o_subject5'];
$o_grade5=$rows['o_grade5'];
$o_subject6=$rows['o_subject6'];
$o_grade6=$rows['o_grade6'];
$o_subject7=$rows['o_subject7'];
$o_grade7=$rows['o_grade7'];
$o_subject8=$rows['o_subject8'];
$o_grade8=$rows['o_grade8'];
$o_subject9=$rows['o_subject9'];
$o_grade9=$rows['o_grade9'];
$a_admi_no=$rows['a_admi_no'];
$a_year=$rows['a_year'];
$a_subject1=$rows['a_subject1'];
$a_grade1=$rows['a_grade1'];
$a_subject2=$rows['a_subject2'];
$a_grade2=$rows['a_grade2'];
$a_subject3=$rows['a_subject3'];
$a_grade3=$rows['a_grade3'];
$a_subject4=$rows['a_subject4'];
$a_grade4=$rows['a_grade4'];
$z_score=$rows['z_score'];
$school_level=$rows['school_level'];
$zonal_level=$rows['zonal_level'];
$district_level=$rows['district_level'];
$provincial_level=$rows['provincial_level'];
$national_level=$rows['national_level'];
$international_level=$rows['international_level'];
$current_activities=$rows['current_activities'];
}
}else{
echo ("No data are available");
}
}else{
echo ("result error");
}
}
//print_r($_POST);
$connection->close();
?>
推荐答案
profile_picture);?>\" id=\"profile_picture\" />
\t\t\t</td>
\t\t\t<td>
\t\t\t\t<p>
\t\t\t\t\t\t\t\t\t<label>Student ID *</label>
\t\t\t\t\t<input type=\"text\" value=\"<?php echo(
profile_picture);?>" id="profile_picture" /> </td> <td> <p> <label>Student ID *</label> <input type="text" value="<?php echo(
student_id);?>IM/20xx/xxx\" name=\"student_id\" id=\"student_id\" />
\t\t\t\t</p>
\t\t\t</td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td>
\t\t\t\t\t<p>
\t\t\t\t\t\t<label>Admitted Date *</label>
\t\t\t\t\t<input type=\"date\" name=\"admitted_date\" value=\"<?php echo(
student_id);?>IM/20xx/xxx" name="student_id" id="student_id" /> </p> </td> </tr> <tr> <td> <p> <label>Admitted Date *</label> <input type="date" name="admitted_date" value="<?php echo(
admitted_date);?>\" id=\"admitted_date\" />
\t\t\t\t\t</p>
\t\t\t\t\t</td>
\t\t\t\t\t< / TR>
\t\t\t<tr>
\t\t\t\t<td>
\t\t\t\t\t<p>
\t\t\t\t\t<label>Academic Year*</label>
\t\t\t\t\t<input type=\"text\" name=\"academic_year\" value=\"<?php echo(
admitted_date);?>" id="admitted_date" /> </p> </td> </tr> <tr> <td> <p> <label>Academic Year*</label> <input type="text" name="academic_year" value="<?php echo(
这篇关于Hoqueries无法正常工作.insert查询工作正常,但其他三个查询无法正常工作它发生了错误我是...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文