OK, I had an issue I couldn't fix, so I had someone write the code for me. Unfortunately, he didn't comment it, and I don't know what it does!! Can someone help??
What I want to do, before I do the insert, is to query the table and see if that record already exists. But I can't tell (for instance, if I just wanted to check student_schedule_id, how would I know what that is? How would I echo only that field to the screen??)
Thanks to anyone who can help!
Here's the code:
<?php
include_once "ez_sql.php";
$clear = $POST['clear'];
reset($clear);
echo('Schedule ID -> ' . substr($POST['id'],0,strlen($POST['id'])-4) . '<br><br>');
foreach($clear as $clr)
{
if($clr==1)
{
$query = "INSERT INTO student_schedule(student_schedule_id,student_schedule_studentid,student_schedule_year,student_schedule_schoolid,student_schedule_schedid)
VALUES(0," . key($clear) . ",0,0," . substr($POST['id'],0,strlen($_POST['id'])-4) . ");";
echo($query."<br><br>");
$db->query($query);
//echo('Student ID -> ' . key($clear) . '... to be inserted<br>');
}
next($clear);
}
?>