Hi All Can someone please tell me what am I doing wrong in this query??? Its not giving me anything? total blank, there is some data in defferent dates Many thanks Zed $query = "SELECT * FROM booking WHERE request_date = '$request_date'"; Code (markup): Full code $day = $_GET['day']; $cMonth = $_GET['cMonth']; $cYear = $_GET['cYear']; $today = time(); $request_date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second ;) if($today > $request_date) { echo "<font color=red>Error, Post date for Booking any lessons. Please choose the avialable date from tomorrow. </font>"; // post date }else{ .....(I took some code out from here) $query = "SELECT * FROM booking WHERE request_date = '$request_date'"; $result = mysql_query($query)or die(mysql_error()); while ($row = mysql_fetch_array($result)) { extract($row); echo " ".$row['request_date']." ".$row['s_time']." ".$row['e_time']." "; } Code (markup):
Unless you deleted some other stuff you didn't close the else. Try this: $day = $_GET['day']; $cMonth = $_GET['cMonth']; $cYear = $_GET['cYear']; $today = time(); $request_date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second ;) if($today > $request_date) { echo "<font color=red>Error, Post date for Booking any lessons. Please choose the avialable date from tomorrow. </font>"; // post date } else { // (I took some code out from here) $query = "SELECT * FROM booking WHERE request_date = '$request_date'"; $result = mysql_query($query)or die(mysql_error()); while ($row = mysql_fetch_array($result)) { extract($row); echo "<br>".$row['request_date']."<br>".$row['s_time']."<br>".$row['e_time']."<br>"; } } echo "works"; PHP: I added in the echo "works" at the bottom so you'll know if the script completed and just didn't find anything with the query. If you don't at least see "works" on the screen then you have a syntax error somewhere.
Thanks for your reply but the problem is in SELECT query, in this bit $query = "SELECT * FROM booking WHERE request_date = '$request_date'"; Code (markup): and I don't know what that is?? Zed
what makes you think that's the problem? I showed you where you didn't close an else statement, that would stop the script from working. There's nothing wrong with the way the query is formatted so unless you have some crap in $request_date it should work fine. Lets start at the obvious first: close the else statement, add the echo "works" part and run the script. Tell me what happens and we can move forward. To ease your own questions add an echo $query; just under the $query line and post the result.