Maq Posted December 11, 2008 Share Posted December 11, 2008 Weird, I just tried this example and it works fine. $error = FALSE; if (1 { $output = "You cannot book a return flight before your out-going flight!"; $error = TRUE; } ?> { echo '' . $output . ''; } else { ?> ELSE? Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713091 Share on other sites More sharing options...
will_1990 Posted December 11, 2008 Author Share Posted December 11, 2008 Weird, I just tried this example and it works fine. <?php $error = FALSE; if (1 < 2) { $output = "You cannot book a return flight before your out-going flight!"; $error = TRUE; } ?> <head> <body> <?php if($error == TRUE) { echo '<h1>' . $output . '</h1>'; } else { ?> <h1>ELSE?</h1> <?php } ?> </head> </body> Nope on mine keeps going round onto the loop and does not return any errors or anything. Mayb phpsensi can help!! why so hard!! Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713101 Share on other sites More sharing options...
will_1990 Posted December 11, 2008 Author Share Posted December 11, 2008 latest output http://img262.imageshack.us/my.php?image=outputxr3.jpg seeeeeee Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713111 Share on other sites More sharing options...
phpSensei Posted December 11, 2008 Share Posted December 11, 2008 Hello, Is your dates this format? 26/12/2008 Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713161 Share on other sites More sharing options...
Maq Posted December 11, 2008 Share Posted December 11, 2008 This is my last attempt. I don't see why it's working in my test and not in your script. Maybe someone else can see the problem... ini_set ("display_errors", "1"); error_reporting(E_ALL); $error = FALSE; //database information $host = "stocks"; // Host name $username = "wbennett"; // Mysql username $password = "mysql5"; // Mysql password $db_name = "wbennett"; // Database name $tbl_name1 = "flight_webair"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Variables $flight_route_out = $_POST['flight_route_out']; $flight_route_return = $_POST['flight_route_return']; $date_out = $_POST['departure_date']; $date_return = $_POST['return_date']; $passenger_num = $_POST['num_of_pass']; $one_way = (isset($_POST['one_way'])) ? $_POST['one_way'] : null; // make sure value is available first. if (strtotime($_POST['return_date']) $output = "You cannot book a return flight before your out-going flight!"; $error = TRUE; } //To protect MySQL injection $flight_route_out = stripslashes($flight_route_out); $flight_route_return = stripslashes($flight_route_return); $flight_route_out = mysql_real_escape_string($flight_route_out); $flight_route_return = mysql_real_escape_string($flight_route_return); //Queries $sql1="SELECT * FROM `$tbl_name1` WHERE `flight_route` = '$flight_route_out'"; //$sql="SELECT * FROM $tbl_name1 WHERE flight_route_return='$flight_route_return'"; //Execute query 1 $result = mysql_query($sql1) or die(mysql_error()); if(mysql_num_rows($result) > 0){ ?> http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> rel="stylesheet" href="dropdown2.css" type="text/css" /> type="text/javascript" src="dropdown.js"> type="text/javascript" src="calendar.js"> type="text/javascript" src="enablefield.js"> Booking Confirmation type="text/javascript"> function greyText(one_way, return_date) { if (document.form1[one_way].checked) { document.form1[return_date].disabled=true; document.form1[return_flight].disabled=true; } else { document.form1[return_date].disabled=false; document.form1[return_flight].disabled=false; } } Webair Contact Us src="Webair--logo.gif" height= "65" width="240" align="top" /> background="Banner--background.gif" height="60" align="right" width="817" > class="hyperlink" href="http://www.cems.uwe.ac.uk/~wbennett/webair/main_logon.php"> Staff login | class="hyperlink" href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html" > Home | class="hyperlink" href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html" > Booked Flights   class="dropdown" > id="one-ddheader" onmouseover="ddMenu('one',1)" onmouseout="ddMenu('one',-1)" > Home id="one-ddcontent" onmouseover="cancelHide('one')" onmouseout="ddMenu('one',-1)" > href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html" class="underline" > Home class="dropdown" > id="two-ddheader" onmouseover="ddMenu('two',1)" onmouseout="ddMenu('two',-1)" > Contact us id="two-ddcontent" onmouseover="cancelHide('two')" onmouseout="ddMenu('two',-1)" > href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_contact" class="underline" > Contact us class="dropdown" > id="three-ddheader" onmouseover="ddMenu('three',1)" onmouseout="ddMenu('three',-1)" > Flights id="three-ddcontent" onmouseover="cancelHide('three')" onmouseout="ddMenu('three',-1)" > href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_refunds.html" class="underline" > Refund Policy class="dropdown" > id="four-ddheader" onmouseover="ddMenu('four',1)" onmouseout="ddMenu('four',-1)" > Travel Information id="four-ddcontent" onmouseover="cancelHide('four')" onmouseout="ddMenu('four',-1)" > href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_flight_fares.html" class="underline" > Flight Timetable href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_baggage.html" class="underline" > Baggage Information href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_airport_info.html" class="underline" > Airport information href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_travel_info.html" class="underline" > Travel documentation requirements class="dropdown" > id="five-ddheader" onmouseover="ddMenu('five',1)" onmouseout="ddMenu('five',-1)" > About Webair id="five-ddcontent" onmouseover="cancelHide('five')" onmouseout="ddMenu('five',-1)" > href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_about.html" class="underline" > About Webair href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_contact.html" class="underline" > Contact us style="clear:both" /> id="content" > id="table_gen_1" > class="inner" > //THERE IS AN ERROR display error message if($error == TRUE) { echo '' . $output . ''; } else { ?> Confirm Booking Out-going Flight Information: while($row = mysql_fetch_array($result)){ echo " </pre> <table border="'1'" cellpadding="10"> Flight Number Flight Route Selected Departure Time Arrival Time Departure Date Return Date Number of Passengers Selected ".$row['flight_num']." ".$row['flight_route']." ".$row['departure_time']." ".$row['arrival_time']." ".$date_out." ".$date_return." ".$passenger_num['num_of_pass']." </table> <br><br> <br><br>"; <br>} <br>}<br>?><br><br><br><br><br><div id="footer"> Staff login | Home | Contact us | About Webair </div> <br> <br> <br> <br> <br> }else{<br> <br> echo 'Sorry, couldn\'t find any flights';<br> <br> } <br> <br>mysql_free_result($result); <br Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713162 Share on other sites More sharing options...
phpSensei Posted December 11, 2008 Share Posted December 11, 2008 change $nonUSdate1 = $date_out; list($day,$month,$year) = explode('/',$nonUSdate1); $newDate = "{$month}/{$day}/{$year}"; $stamp = strtotime($newDate1); to $nonUSdate1 = $date_out; list($day,$month,$year) = explode('/',$nonUSdate1); $newDate1 = "{$month}/{$day}/{$year}"; $stamp = strtotime($newDate1); Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713172 Share on other sites More sharing options...
phpSensei Posted December 11, 2008 Share Posted December 11, 2008 change $nonUSdate2 = $date_return; list($day,$month,$year) = explode('/',$nonUSdate2); $newDate = "{$month}/{$day}/{$year}"; $stamp = strtotime($newDate2); to $nonUSdate2 = $date_return; list($day,$month,$year) = explode('/',$nonUSdate2); $newDate2 = "{$month}/{$day}/{$year}"; $stamp2 = strtotime($newDate2); Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713173 Share on other sites More sharing options...
phpSensei Posted December 11, 2008 Share Posted December 11, 2008 And Full Code Should be: <?php // Variables $flight_route_out = $_POST['flight_route_out']; $flight_route_return = $_POST['flight_route_return']; $date_out = $_POST['departure_date']; $date_return = $_POST['return_date']; $passenger_num = $_POST['num_of_pass']; $one_way = (isset($_POST['one_way'])) ? $_POST['one_way'] : null; // make sure value is available first. $nonUSdate1 = $date_out; list($day,$month,$year) = explode('/',$nonUSdate1); $newDate1 = "{$month}/{$day}/{$year}"; $stamp = strtotime($newDate1); $nonUSdate2 = $date_return; list($day,$month,$year) = explode('/',$nonUSdate2); $newDate2 = "{$month}/{$day}/{$year}"; $stamp2 = strtotime($newDate2); //To protect MySQL injection $flight_route_out = stripslashes($flight_route_out); $flight_route_return = stripslashes($flight_route_return); $flight_route_out = mysql_real_escape_string($flight_route_out); $flight_route_return = mysql_real_escape_string($flight_route_return); //Queries $sql1="SELECT * FROM `$tbl_name1` WHERE `flight_route` = '$flight_route_out'"; //$sql="SELECT * FROM $tbl_name1 WHERE flight_route_return='$flight_route_return'"; //Execute query 1 $result = mysql_query($sql1) or die(mysql_error()); if ($stamp < $stamp2){ echo "You cannot return before you leave!"; } ?> You forgot to change $newDate to $newDate1 and $newDate2, Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713176 Share on other sites More sharing options...
will_1990 Posted December 11, 2008 Author Share Posted December 11, 2008 And Full Code Should be: <?php // Variables $flight_route_out = $_POST['flight_route_out']; $flight_route_return = $_POST['flight_route_return']; $date_out = $_POST['departure_date']; $date_return = $_POST['return_date']; $passenger_num = $_POST['num_of_pass']; $one_way = (isset($_POST['one_way'])) ? $_POST['one_way'] : null; // make sure value is available first. $nonUSdate1 = $date_out; list($day,$month,$year) = explode('/',$nonUSdate1); $newDate1 = "{$month}/{$day}/{$year}"; $stamp = strtotime($newDate1); $nonUSdate2 = $date_return; list($day,$month,$year) = explode('/',$nonUSdate2); $newDate2 = "{$month}/{$day}/{$year}"; $stamp2 = strtotime($newDate2); //To protect MySQL injection $flight_route_out = stripslashes($flight_route_out); $flight_route_return = stripslashes($flight_route_return); $flight_route_out = mysql_real_escape_string($flight_route_out); $flight_route_return = mysql_real_escape_string($flight_route_return); //Queries $sql1="SELECT * FROM `$tbl_name1` WHERE `flight_route` = '$flight_route_out'"; //$sql="SELECT * FROM $tbl_name1 WHERE flight_route_return='$flight_route_return'"; //Execute query 1 $result = mysql_query($sql1) or die(mysql_error()); if ($stamp < $stamp2){ echo "You cannot return before you leave!"; } ?> You forgot to change $newDate to $newDate1 and $newDate2, dude is this right: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); $error = FALSE; //database information $host = "stocks"; // Host name $username = "wbennett"; // Mysql username $password = "mysql5"; // Mysql password $db_name = "wbennett"; // Database name $tbl_name1 = "flight_webair"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Variables $flight_route_out = $_POST['flight_route_out']; $flight_route_return = $_POST['flight_route_return']; $date_out = $_POST['departure_date']; $date_return = $_POST['return_date']; $passenger_num = $_POST['num_of_pass']; $one_way = (isset($_POST['one_way'])) ? $_POST['one_way'] : null; // make sure value is available first. $nonUSdate1 = $date_out; list($day,$month,$year) = explode('/',$nonUSdate1); $newDate1 = "{$month}/{$day}/{$year}"; $stamp = strtotime($newDate1); $nonUSdate2 = $date_return; list($day,$month,$year) = explode('/',$nonUSdate2); $newDate2 = "{$month}/{$day}/{$year}"; $stamp2 = strtotime($newDate2); //To protect MySQL injection $flight_route_out = stripslashes($flight_route_out); $flight_route_return = stripslashes($flight_route_return); $flight_route_out = mysql_real_escape_string($flight_route_out); $flight_route_return = mysql_real_escape_string($flight_route_return); //Queries $sql1="SELECT * FROM `$tbl_name1` WHERE `flight_route` = '$flight_route_out'"; //$sql="SELECT * FROM $tbl_name1 WHERE flight_route_return='$flight_route_return'"; //Execute query 1 $result = mysql_query($sql1) or die(mysql_error()); if ($stamp < $stamp2){ echo "You cannot return before you leave!"; } if(mysql_num_rows($result) > 0){ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713188 Share on other sites More sharing options...
phpSensei Posted December 11, 2008 Share Posted December 11, 2008 yes correct. Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713193 Share on other sites More sharing options...
will_1990 Posted December 11, 2008 Author Share Posted December 11, 2008 yes correct. i get no output at all this sucks im never gona get this submitted in time! lame. thanks all the same Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713196 Share on other sites More sharing options...
phpSensei Posted December 12, 2008 Share Posted December 12, 2008 yes correct. i get no output at all this sucks im never gona get this submitted in time! lame. thanks all the same It works for me, try echoing this: $date_out = $_POST['departure_date']; $date_return = $_POST['return_date']; echo out those two vars and tell me what they give you. Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713208 Share on other sites More sharing options...
will_1990 Posted December 12, 2008 Author Share Posted December 12, 2008 yes correct. i get no output at all this sucks im never gona get this submitted in time! lame. thanks all the same It works for me, try echoing this: $date_out = $_POST['departure_date']; $date_return = $_POST['return_date']; echo out those two vars and tell me what they give you. cant impliment that when i cant get any output... will try and return all vars 1 sec this doesnt not work either using print_r($_POST); Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713218 Share on other sites More sharing options...
will_1990 Posted December 12, 2008 Author Share Posted December 12, 2008 Shall i revert to this short term and add your changes. Atleast i had some browser output at that point. <?php print_r($_POST); ini_set ("display_errors", "1"); error_reporting(E_ALL); $error = FALSE; //database information $host = "stocks"; // Host name $username = "wbennett"; // Mysql username $password = "mysql5"; // Mysql password $db_name = "wbennett"; // Database name $tbl_name1 = "flight_webair"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Variables $flight_route_out = $_POST['flight_route_out']; $flight_route_return = $_POST['flight_route_return']; $date_return = $_POST['return_date']; $date_out = $_POST['departure_date']; $passenger_num = $_POST['num_of_pass']; $one_way = (isset($_POST['one_way'])) ? $_POST['one_way'] : null; // make sure value is available first. $nonUSdate1 = $date_out; list($day,$month,$year) = explode('/',$nonUSdate1); $newDate1 = "{$month}/{$day}/{$year}"; $stamp = strtotime($newDate1); $nonUSdate2 = $date_return; list($day,$month,$year) = explode('/',$nonUSdate2); $newDate2 = "{$month}/{$day}/{$year}"; $stamp2 = strtotime($newDate2); //To protect MySQL injection $flight_route_out = stripslashes($flight_route_out); $flight_route_return = stripslashes($flight_route_return); $flight_route_out = mysql_real_escape_string($flight_route_out); $flight_route_return = mysql_real_escape_string($flight_route_return); //Queries $sql1="SELECT * FROM `$tbl_name1` WHERE `flight_route` = '$flight_route_out'"; //$sql="SELECT * FROM $tbl_name1 WHERE flight_route_return='$flight_route_return'"; //Execute query 1 $result = mysql_query($sql1) or die(mysql_error()); if ($stamp < $stamp2){ echo "You cannot return before you leave!"; } if(mysql_num_rows($result) > 0){ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="dropdown2.css" type="text/css" /> <script type="text/javascript" src="dropdown.js"> </script> <script type="text/javascript" src="calendar.js"> </script> <script type="text/javascript" src="enablefield.js"> </script> <title> Booking Confirmation </title> <script type="text/javascript"> function greyText(one_way, return_date) { if (document.form1[one_way].checked) { document.form1[return_date].disabled=true; document.form1[return_flight].disabled=true; } else { document.form1[return_date].disabled=false; document.form1[return_flight].disabled=false; } } <title>Webair Contact Us</title> <link rel="StyleSheet" href="./mainstyle.css"type="text/css" media="screen"> </script> </head> <body> <div id="wrapper"> <table> <tr> <td> <img src="Webair--logo.gif" height= "65" width="240" align="top" /> </td> <td background="Banner--background.gif" height="60" align="right" width="817" > <a class="hyperlink" href="http://www.cems.uwe.ac.uk/~wbennett/webair/main_logon.php"> <b> Staff login </b> </a> | <a class="hyperlink" href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html" > <b> Home </b> </a> | <a class="hyperlink" href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html" > <b> Booked Flights   </b> </a> </td> </tr> </table> <dl class="dropdown" > <dt id="one-ddheader" onmouseover="ddMenu('one',1)" onmouseout="ddMenu('one',-1)" > Home </dt> <dd id="one-ddcontent" onmouseover="cancelHide('one')" onmouseout="ddMenu('one',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html" class="underline" > Home </a> </li> </ul> </dd> </dl> <dl class="dropdown" > <dt id="two-ddheader" onmouseover="ddMenu('two',1)" onmouseout="ddMenu('two',-1)" > Contact us </dt> <dd id="two-ddcontent" onmouseover="cancelHide('two')" onmouseout="ddMenu('two',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_contact" class="underline" > Contact us </a> </li> </ul> </dd> </dl> <dl class="dropdown" > <dt id="three-ddheader" onmouseover="ddMenu('three',1)" onmouseout="ddMenu('three',-1)" > Flights </dt> <dd id="three-ddcontent" onmouseover="cancelHide('three')" onmouseout="ddMenu('three',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_refunds.html" class="underline" > Refund Policy </a> </li> </ul> </dd> </dl> <dl class="dropdown" > <dt id="four-ddheader" onmouseover="ddMenu('four',1)" onmouseout="ddMenu('four',-1)" > Travel Information </dt> <dd id="four-ddcontent" onmouseover="cancelHide('four')" onmouseout="ddMenu('four',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_flight_fares.html" class="underline" > Flight Timetable </a> </li> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_baggage.html" class="underline" > Baggage Information </a> </li> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_airport_info.html" class="underline" > Airport information </a> </li> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_travel_info.html" class="underline" > Travel documentation requirements </a> </li> </ul> </dd> </dl> <dl class="dropdown" > <dt id="five-ddheader" onmouseover="ddMenu('five',1)" onmouseout="ddMenu('five',-1)" > About Webair </dt> <dd id="five-ddcontent" onmouseover="cancelHide('five')" onmouseout="ddMenu('five',-1)" > <ul> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_about.html" class="underline" > About Webair </a> </li> <li> <a href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_contact.html" class="underline" > Contact us </a> </li> </ul> </dd> </dl> <div style="clear:both" /> </div> <div id="content" > <div id="table_gen_1" > <div class="inner" > <br> <?php //THERE IS AN ERROR display error message if($error == TRUE) { echo '<h1>' . $output . '</h1>'; } else { ?> <h1><center> Confirm Booking </center></h1> <h3><b><u> Out-going Flight Information: </u></b></h3> <?php while($row = mysql_fetch_array($result)){ echo " <br><br> <table border='1' cellpadding=10> <tr> <td class='table'> <center><b> Flight Number </b></center> </td> <td class='table'> <center><b> Flight Route Selected </b></center> </td> <td class='table'> <center><b> Departure Time </b> </center> </td> <td class='table'> <center><b> Arrival Time </b></center> </td> <td class='table'> <center><b> Departure Date </b></center> </td> <td class='table'> <center><b> Return Date </b></center> </td> <td class='table'> <center><b> Number of Passengers Selected </b></center> </td> </tr> <tr> <td class='table'> <center> ".$row['flight_num']." </center> </td> <td class='table'> <center> ".$row['flight_route']." </center> </td> <td class='table'> <center> ".$row['departure_time']." </center> </td> <td class='table'> <center> ".$row['arrival_time']." </center> </td> <td class='table'> <center> ".$date_out." </center> </td> <td class='table'> <center> ".$date_return." </center> </td> <td class='table'> <center> ".$passenger_num['num_of_pass']." </center> </td> </tr> </table> <br><br>"; } } ?> </div> </div> </div> <div id="footer"> <div id="inner"> <div id="footer2"> <p><hr class="line"></hr> <a class="hyperlink2" href="http://www.cems.uwe.ac.uk/~wbennett/webair/main_logon.php"><b>Staff login</b></a> | <a class="hyperlink2" href="http://www.cems.uwe.ac.uk/~wbennett/webair/index.html"><b>Home</b></a> | <a class="hyperlink2" href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_contact.html"><b>Contact us</b></a> | <a class="hyperlink2" href="http://www.cems.uwe.ac.uk/~wbennett/webair/webair_about.html"><b>About Webair</b></a> <hr class="line2"></hr> </p> </div> </div> </div> </body> </html> <?php }else{ echo 'Sorry, couldn\'t find any flights'; } mysql_free_result($result); ?> maybe useful this has held me up so much i have loads left to do for tomorrow morning, how lame going to be a all nighter! Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713222 Share on other sites More sharing options...
phpSensei Posted December 12, 2008 Share Posted December 12, 2008 sorry went eating.. will dont make it so hard on yourself man, its simple just add this after your vars echo $_POST['departure_date']; echo $_POST['return_date']; Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713240 Share on other sites More sharing options...
will_1990 Posted December 12, 2008 Author Share Posted December 12, 2008 sorry went eating.. will dont make it so hard on yourself man, its simple just add this after your vars echo $_POST['departure_date']; echo $_POST['return_date']; Array ( [flight_route_out] => Bristol - Newcastle [departure_date] => 23/12/2008 [flight_route_return] => Bristol - Newcastle [return_date] => 23/12/2008 [num_of_pass] => 1 [submit] => Submit ) 23/12/200823/12/2008 there is that any help? it also returned everything from the where loop and layout stuff thanks i wont be, i just hate deadlines. Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713243 Share on other sites More sharing options...
phpSensei Posted December 12, 2008 Share Posted December 12, 2008 sorry went eating.. will dont make it so hard on yourself man, its simple just add this after your vars echo $_POST['departure_date']; echo $_POST['return_date']; Array ( [flight_route_out] => Bristol - Newcastle [departure_date] => 23/12/2008 [flight_route_return] => Bristol - Newcastle [return_date] => 23/12/2008 [num_of_pass] => 1 [submit] => Submit ) 23/12/200823/12/2008 there is that any help? it also returned everything from the where loop and layout stuff thanks i wont be, i just hate deadlines. okay now print out the $stamp and $stamp 2 Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713254 Share on other sites More sharing options...
will_1990 Posted December 12, 2008 Author Share Posted December 12, 2008 sorry went eating.. will dont make it so hard on yourself man, its simple just add this after your vars echo $_POST['departure_date']; echo $_POST['return_date']; Array ( [flight_route_out] => Bristol - Newcastle [departure_date] => 23/12/2008 [flight_route_return] => Bristol - Newcastle [return_date] => 23/12/2008 [num_of_pass] => 1 [submit] => Submit ) 23/12/200823/12/2008 there is that any help? it also returned everything from the where loop and layout stuff thanks i wont be, i just hate deadlines. okay now print out the $stamp and $stamp 2 Here the result mate: Array ( [flight_route_out] => Bristol - Newcastle [departure_date] => 23/12/2008 [flight_route_return] => Bristol - Newcastle [return_date] => 16/12/2008 [num_of_pass] => 1 [submit] => Submit ) 16/12/200823/12/200812299904001229385600 Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713260 Share on other sites More sharing options...
phpSensei Posted December 12, 2008 Share Posted December 12, 2008 1229990400 is not less than 1229385600 Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713265 Share on other sites More sharing options...
will_1990 Posted December 12, 2008 Author Share Posted December 12, 2008 Array ( [flight_route_out] => Bristol - Newcastle [departure_date] => 31/12/2008 [flight_route_return] => Bristol - Newcastle [return_date] => 17/12/2008 [num_of_pass] => 1 [submit] => Submit ) 17/12/2008 31/12/2008 12306816001229472000 its swapping the order round some where, ive got them the wrong way round at some point but im not sure where, (which is right and which is wrong) compare the talbe and the array in the screenshot! http://img254.imageshack.us/my.php?image=fix1pa9.jpg do u c what i mean? Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713274 Share on other sites More sharing options...
will_1990 Posted December 12, 2008 Author Share Posted December 12, 2008 Array ( [flight_route_out] => Bristol - Newcastle [departure_date] => 31/12/2008 [flight_route_return] => Bristol - Newcastle [return_date] => 17/12/2008 [num_of_pass] => 1 [submit] => Submit ) 17/12/2008 31/12/2008 12306816001229472000 its swapping the order round some where, ive got them the wrong way round at some point but im not sure where, (which is right and which is wrong) compare the talbe and the array in the screenshot! http://img254.imageshack.us/my.php?image=fix1pa9.jpg do u c what i mean? Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713286 Share on other sites More sharing options...
will_1990 Posted December 12, 2008 Author Share Posted December 12, 2008 Array ( [flight_route_out] => Bristol - Newcastle [departure_date] => 31/12/2008 [flight_route_return] => Bristol - Newcastle [return_date] => 17/12/2008 [num_of_pass] => 1 [submit] => Submit ) 17/12/2008 31/12/2008 12306816001229472000 its swapping the order round some where, ive got them the wrong way round at some point but im not sure where, (which is right and which is wrong) compare the talbe and the array in the screenshot! http://img254.imageshack.us/my.php?image=fix1pa9.jpg do u c what i mean? scrap that i was wrong, the return date is before the depart date Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713287 Share on other sites More sharing options...
phpSensei Posted December 12, 2008 Share Posted December 12, 2008 He leave the 31st of January and comes back the 17 of january lol? Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713302 Share on other sites More sharing options...
will_1990 Posted December 12, 2008 Author Share Posted December 12, 2008 exactly, i did it like this to try and provoke an error to spot the script running, this is what it should do right? Quote Link to comment https://forums.phpfreaks.com/topic/136553-what-is-wrong-with-my-date-comparison-structure/page/2/#findComment-713326 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.