scottjgd Posted September 6, 2010 Report Share Posted September 6, 2010 So what I am looking to do is add the ability to search the schedules by division. Our VA uses divisions to distinguish flights in the schedule as follows: CCC-NOC001 CCC-EOC001 etc. Where the NOC and EOC are divisions. We currently have 9 divisions and the complaint I'm getting is that with all the schedules its hard find a flight they are looking for. So I want to create a division filter based on the flightnum field which in itself is easy enough to do, but I would wind up with a drop-down list of ever flight in the database. What I need to know is how can I create it so that it only searchs for the division code. <div id="division"> <p>Select Division</p> <select id="division" name="division"> <option value="">Select Division</option> <?php if(!$division) $division = array(); foreach($division as $divis) { echo '<option value="'.$divis->name.'">'.$divis->name.'</option>'; } ?> </select> <input type="submit" name="submit" value="Find Flights" /> </div> this is the code for the table so all I need is the code that would be placed in schedules.php or more to the point what I need to make the code look in the flight num for just the 3 letter division code. Quote Link to comment Share on other sites More sharing options...
Alex Posted September 6, 2010 Report Share Posted September 6, 2010 Scott rather than duplicating posts have a look here, where we are going through the same thing. topic Quote Link to comment Share on other sites More sharing options...
scottjgd Posted September 6, 2010 Author Report Share Posted September 6, 2010 Sorry But this is not a duplicate post my problem is different, that part I already pretty much knew and would result in a drop down list of about 500 items in length what i need is how to truncate the data field so only the 3 letters of the flight num show up so instead of -NOC001 I get NOC. Thank You for your input though Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted September 6, 2010 Administrators Report Share Posted September 6, 2010 Is your division based on airline code, or did you add a new field? Quote Link to comment Share on other sites More sharing options...
scottjgd Posted September 6, 2010 Author Report Share Posted September 6, 2010 its relative data it is just in the flight number where the flight number for example -NOC001 basically i want to strip out the numbers at the end of the flight number for the search filter Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted September 13, 2010 Administrators Report Share Posted September 13, 2010 You'd have to do a LIKE query $division = '-NOC001'; $params = array( "s.flightnum LIKE '%{$division}%'", ); $allflights = SchedulesData::findSchedules($params); Something like that 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.