if(isset($_REQUEST['SAVE'])) {
$sql = "SELECT SecName FROM section WHERE SecID='$section'";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$SecName = $row["SecName"];
}
$sql = "SELECT SubjName FROM subject WHERE SubjID='$subject'";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$SubjName = $row["SubjName"];
}
$check = mysql_query("SELECT SecID FROM service where SubjID='$SubjName'")or die(mysql_error());
$bool = 1;
while($info = mysql_fetch_array( $check ))
if(($info['SecID'] == $SecName)){
$bool = 0;
}
if($bool){
$check = mysql_query("SELECT * FROM service ")or die(mysql_error());
$bool = 1;
while($info = mysql_fetch_array( $check ))
if(($info['Start_date'] == $Start_date) && ($info['Venue'] == $Venue) || ($info['Start_date'] == $Start_date) && ($info['Facilitator'] == $Facilitator)){
$bool = 0;
}
if($bool){
$sql="INSERT INTO service ( ServiceID, Date, Semester, School_year, Start_date, Venue, Facilitator, Stype, SecID, SubjID)VALUES('$RecCode','$Date','$Semester','$School_year','$Start_date','$Venue','$Facilitator','$Stype', '$SecName', '$SubjName')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo '<script type="text/javascript">';
echo 'alert("Save Successfully!");';
echo 'window.location="Admin_RecSchedMapLst.php";';
echo '</script>';
mysql_close($con);
}else
{
echo '<script type="text/javascript">';
echo 'alert("Conflicting schedule for Venue or Facilitator!");';
echo '</script>';
}
}else
{
echo '<script type="text/javascript">';
echo 'alert("The SECTION has been already scheduled!");';
echo '</script>';
}
}
/* $result = mysql_query("SELECT SIDno FROM class WHERE SecID=$SecID AND SubjID=$SubjID");
$row = mysql_fetch_assoc($result);
$SIDno = $row['SIDno'];
$result = mysql_query("SELECT ServiceID FROM service WHERE SecID=$SecID AND SubjID=$SubjID");
$row = mysql_fetch_assoc($result);
$ServiceID = $row['ServiceID'];
$sql="INSERT INTO registered ( ServiceID, IDno, Stype )VALUES('$ServiceID','$SIDno','$Stype')"; */
}
Bu kod, düzgün çalışıyor. ben sadece nasıl ben muhtemelen yukarıda yorumladı olduğu Pazar sabahı şovmen nod kod üzerinde çalışabilirsiniz sormak istiyorum. i yapmak istediğiniz tüm serviceID i derhal kayıtlı başka bir tabloya, KİM NO, türü serviceID eklemek de istiyorum takıldığında olduğunu.