Aaron Posted March 20, 2012 Report Posted March 20, 2012 Hello, my VA is completely charter flights (military VA), what I have is a booking system that updates the schedules where the flightnum is the pid. Instead of manually adding these routes in for every pilot that registers, I want to have it add a row in the schedules during registration that sets the flightnum to the pid and leaves everything else blank. I know the code to add a row, I just don't know where I should put it and in which file. I took a crack at it before March break and it didn't seem to work. Any ideas? Quote
Aaron Posted March 21, 2012 Author Report Posted March 21, 2012 I put this in the RegistrationData.class.php as the last thing to run when a user submits their registration (bottom of AddUser function) and it doesn't work I'm trying to figure out why. Note: used $sql2 to avoid using variable twice $sql2 = "INSERT INTO ".TABLE_PREFIX."schedules (code, flightnum, deptime, arrtime, daysofweek, price, flighttype, enabled) VALUES ('CFC', $pilotid, '00:00', '00:00', '0123456', '0', 'P', '1')"; DB::query($sql2); Quote
Moderators Kyle Posted March 21, 2012 Moderators Report Posted March 21, 2012 I put this in the RegistrationData.class.php as the last thing to run when a user submits their registration (bottom of AddUser function) and it doesn't work I'm trying to figure out why. Note: used $sql2 to avoid using variable twice Try this, with the $sql. in there, it'll still run the query. Remove the code above you used, and put this one in. $sql .= "INSERT INTO ".TABLE_PREFIX."schedules (code, flightnum, deptime, arrtime, daysofweek, price, flighttype, enabled) VALUES ('CFC', $pilotid, '00:00', '00:00', '0123456', '0', 'P', '1')"; Be sure to put it before the DB::query($sql) Or whatever it is like. Quote
Moderators Kyle Posted March 21, 2012 Moderators Report Posted March 21, 2012 nope Must did something wrong with my code. wasn't tested.... give me a few mins. Quote
Moderators Kyle Posted March 21, 2012 Moderators Report Posted March 21, 2012 Can you tell me where are you putting this code? Which lines? Quote
Aaron Posted March 21, 2012 Author Report Posted March 21, 2012 I putting it in core->classes->RegistrationData.class.php and within that file I put it at the very bottom of the function "AddUser" Quote
Administrators simpilot Posted March 21, 2012 Administrators Report Posted March 21, 2012 Remove the "." from your operator and also single quote the $pilotid $sql = "INSERT INTO ".TABLE_PREFIX."schedules (code, flightnum, deptime, arrtime, daysofweek, price, flighttype, enabled) VALUES ('CFC', '$pilotid', '00:00', '00:00', '0123456', '0', 'P', '1')"; DB::query($sql); Also, be sure you are putting it prior to return true; on line 173 and that the schedule code is a valid code in your database. It seems to work on my test install. Quote
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.