Jump to content

Recommended Posts

  • Moderators
Posted

Hello All,

I hope you are fine :). I am trying to create a new module for my virtual airline but i have stuck in something(i think very silly). More than three hours have passed but i can't find anything. For some reason it does not send the data to the database. Can you find the problem?

 public function assign_checkride()
{
$this->set('pilots', AcademyData::get_pilots());
$this->set('exams', AcademyData::get_exams());
$this->render('academy/checkride_assign.tpl');
}

public function checkride_theory_assign()
{
$ret = AcademyData::theory_checkride_assign($this->post->examid, $this->post->pilotid, $this->post->by, $this->post->at);
$this->set('message', 'Added');
$this->render('core_success.tpl');
}

 public function theory_checkride_assign($examid, $pilotid, $by, $at) {
$examid = DB::escape($examid);
 $pilotid = DB::escape($pilotid);
 $by = DB::escape($by);
$at = DB::escape($at);
 $sql="INSERT INTO phpvms_fssexams_available
(id, examid, pilotid, by, at)
VALUES ('', '$examid', '$pilotid', '$by', '$at')";
 DB::query($sql);
}

<h3>Assign Theory Checkride to a Trainee</h3>
<center><form id="form" action="<?php echo adminaction('/academy/checkride_theory_assign/'); ?>" method="post">
<table width="60%" border="0">
<tr>
<td>Trainee:</td>
<td><select name="pilotid">
<?php
foreach($pilots as $plt)
{ ?>
<option value="<?php echo $plt->pilotid; ?>"><?php echo $plt->lastname; ?></option> <?php } ?>
</select></td>
</tr>
<tr>
<td>Checkride Type:</td>
<td><select name="examid">
<?php
foreach($exams as $exm)
{ ?>
<option value="<?php echo $exm->id; ?>"><?php echo $exm->exam_description; ?></option> <?php } ?>
</select></td>
</tr>
<tr>
<td colspan="2"><center><input type="submit" name="submit" value="Submit This Material" /></center></td>
</tr>
</table>
</form></center>
<br />

Another eye is always helpful :P.

Posted

Try running the query from phpMyAdmin with dummy data and you'll be able to rule out any SQL issues.

By the looks of it though, if id is auto_increment you can just omit it from your INSERT.

  • Moderators
Posted

Thank you very very very very much! :P I changed 'by' to 'addedby' and everything worked!!

Having sent almost more than four hours today just for this. -_- -_-

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.

Loading...
×
×
  • Create New...