This topic is locked

Before SQL list page

5/28/2010 10:10:49 AM
PHPRunner General questions
M
merlingolden author

Now I'm checking your application

I have created some hotel room booking application

with some fields

Now I would like to get the list of rooms free on a specific day

i have created a query like
SELECT* from rooms WHERE roomnum NOT IN (SELECT rooms.roomnum FROM rooms WHERE rooms.date='$searchDate')

is it correct format to be put befor sql events in list page to get the free rooms for the day searched.
Merlin

A
ann 5/31/2010

Merlin,
unfortunately PHPRunner do not support this type of search. You can implement it manually using custom code in the Before SQL query event on the Events tab. Here is just a sample:

if ($_REQUEST["a"]=="customsearch")

{

$searchDate = $_REQUEST["searchdate"];

$strWhereClause = whereAdd($strWhereClause,"roomnum NOT IN (SELECT roomnum FROM rooms WHERE `date`='".$searchDate."')");

}



Then you can use this URL to search for free room for selected date(say 10/10/2010):

rooms_list.php?a=customsearch&searchdate=2010-10-10
M
merlingolden author 5/31/2010

Thanks it works!!!!!!!!!!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=50186&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
one more question

In the custom search page is it possible to use the phprunner datepicker to insert the date for search? if yes how? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=50186&image=2&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
thanks

Merlin

A
ann 6/1/2010

Merlin,
unfortunately, you can't use datepicker for the custom search page.