Drop Down Dates problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Forum Newbie
Posts: 5
Joined: Fri Apr 17, 2009 12:55 pm

Drop Down Dates problem

Post by cupramen »

This is another drop down box problem, i wanted make a query where you chose the date by using drop down menus and the query is then printed however i seem to get this problem printed.

Warning: oci_execute() [function.oci-execute]: ORA-01861: literal does not match format string in C:\Apache\Apache2\htdocs\project\query1.php on line 24

It works perfectly well with one drop down box but if i add two more then this problem comes up. i am using oracle and php btw

This is the drop down list, i do not know where i am going wrong, is it possible for me to do this or can i know use one drop down list to fetch the table.I want to have days months and years drop down boxes seperate.

Code: Select all

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
  <p>Add a new airline to the database.</p>
<select name="departure_date">
  <option value=01>01</option>
  <option value=02>02</option>
  <option value=03>03</option>
  <option value=04>04</option>
  <option value=05>05</option>
  <option value=06>06</option>
  <option value=07>07</option>
  <option value=08>08</option>
  <option value=09>09</option>
  <option value=10>10</option>
  <option value=11>11</option>
  <option value=12>12</option>
  <option value=13>13</option>
  <option value=14>14</option>
  <option value=15>15</option>
  <option value=16>16</option>
  <option value=17>17</option>
  <option value=18>18</option>
  <option value=19>19</option>
  <option value=20>20</option>
  <option value=21>21</option>
  <option value=22>22</option>
  <option value=23>23</option>
  <option value=24>24</option>
  <option value=25>25</option>
  <option value=26>26</option>
  <option value=27>27</option>
  <option value=28>28</option>
  <option value=29>29</option>
  <option value=30>30</option>
  <option value=31>31</option>
<select name="departure_date">
  <option value=jan>jan</option>
  <option value=feb>Febuaray</option>
  <option value=mar>March</option>
  <option value=apr>April</option>
  <option value=may>May</option>
  <option value=jun>June</option>
  <option value=jul>jul</option>
  <option value=aug>August</option>
  <option value=sep>September</option>
  <option value=oct>October</option>
  <option value=nov>November</option>
  <option value=dec>December</option>
<select name="departure_date">
  <option value=2009>2009</option>
   <input type="submit" name="submit1" value="Submit!"/>
   <input type="reset" VALUE="Clear"></p>
     <a href = "test.html"> Menu</a>
This is the PHP page which i belive is ok and has no problems but it could be this

Code: Select all

    include "test1.php";
   if (isset($_POST['submit1']))
   $c = oci_connect('hr', 'hr');
   $departure_date = $_POST['departure_date'];
   $result = oci_parse($c,
      "select fs.flight_number, a.airline_name, fs.departing_from, fs.arriving_to, fs.airport_departing, fs.date_departing, fs.date_arriving, fc.flight_price
            from flight_schedules fs JOIN airlines a
            on fs.airline_code = a.airline_code
            JOIN flight_costs fc
            on fs.flight_number = fc.flight_number
            where date_departing = '$departure_date'");
   echo "<table border='1'>";
   echo "<tr>";
   for ($i = 1; $i <= oci_num_fields($result); $i++)
     echo "<th>".oci_field_name($result, $i)."</th>";
   echo "</tr>";
   while ($flights = oci_fetch_row($result)) {
     $flight_number = $flights[0];
     $airline_name = $flights[1];
     $departing_from = $flights[2];
     $arriving_to = $flights[3];
     $airport_departing = $flights[4];
     $date_departing = $flights[5];
     $date_arriving = $flights[6];
     $flight_price = $flights[7];
     echo "<tr>";
     echo "<td>$flight_number</td><td>airline_name</td>";
     echo "<td>$departing_from</td><td>$arriving_to</td>";
     echo "<td>$airport_departing</td><td>$date_departing</td>";
     echo "<td>$date_arriving</td><td>$flight_price</td>";
     echo "</tr>";
   echo "</table>";
Post Reply