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();

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.