Jump to content

query after a form insert is it a commit problem?


dolcezza

Recommended Posts

I have a form, when the user clicks "submit" it inserts into a database AND sends the info through a pdf. The new info in the form is not being included in the pdf. It is inserted in the database though and if you go back and do it over, it shoes up on the pdf. The other variables are working fineCould this be a commit issue? If so, how do you handle something like this?

$schedulequery = ("SELECT * FROM `schedule` WHERE eventid = '$eventid'");
$scheduleresult=mysql_query($schedulequery);

for ($i = 1; $i <= 3; $i++) {
    $time = $_POST['time-' . $i];
    $grades = $_POST['grades-' . $i];
    $room = $_POST['room-' . $i];
    $notes = $_POST['notes-' . $i];
if ($time) {
    $scheduleinsert = "INSERT INTO schedules (eventid, time, grades, room, notes) VALUES ('$eventid', '$time', '$grades', '$room', '$notes')";
    $schedule_result=mysql_query($scheduleinsert);
    }
}

other code in between...

$pdf->Cell(10,10, 'Schedule:' ,0,1);

$schedule_query="SELECT * from schedules where eventid=$eventid ORDER BY time";
$schedule_result=mysql_query($schedule_query);
for ($i=1;$i<mysql_num_rows($schedule_result);$i++) {
    $schedule_info=mysql_fetch_array($schedule_result);
    $schedule=$schedule_info['time'] . $schedule_info['grades'] . $schedule_info['room'] . $schedule_info['notes']; 
$pdf->Cell(10,10, $schedule ,0,1);
}

$pdf->Cell(10,10, 'Contact:' ,0,1);
$pdf->Cell(10,10, $name ,0,1);
$pdf->Cell(10,10, $email ,0,1);
$pdf->Cell(10,10, $phone ,0,1);
$pdf->Output();

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.