Moderators servetas Posted July 20, 2013 Moderators Report Share Posted July 20, 2013 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 . Quote Link to comment Share on other sites More sharing options...
Jon Posted July 20, 2013 Report Share Posted July 20, 2013 What's the table name you're trying to go into? phpvms_fssexams_available Doesn't seem right to me with an extra s phpvms_fsexams_available Jon Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted July 20, 2013 Author Moderators Report Share Posted July 20, 2013 It is correct. It means Flight Scheduling System. Quote Link to comment Share on other sites More sharing options...
Tom Posted July 20, 2013 Report Share Posted July 20, 2013 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. Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted July 20, 2013 Author Moderators Report Share Posted July 20, 2013 If i omit it, the result is the same. On the other INSERT queries i do this with the same way and everything is OK. Quote Link to comment Share on other sites More sharing options...
Tom Posted July 20, 2013 Report Share Posted July 20, 2013 Ok, try running it manually with dummy data? Quote Link to comment Share on other sites More sharing options...
mseiwald Posted July 20, 2013 Report Share Posted July 20, 2013 it gave me a syntax error...but when i changed the "by" column name to something else like... "addedby" or whatever then it worked 1 Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted July 20, 2013 Author Moderators Report Share Posted July 20, 2013 Thank you very very very very much! I changed 'by' to 'addedby' and everything worked!! Having sent almost more than four hours today just for this. -_- Quote Link to comment Share on other sites More sharing options...
mseiwald Posted July 20, 2013 Report Share Posted July 20, 2013 hehe no problem, glad i could help Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 22, 2013 Administrators Report Share Posted July 22, 2013 Reserved names will drive you nuts sometimes - I keep this list handy to help avoid conflicts. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.