Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
please help with query
Old 08-12-2004, 05:08 PM please help with query
Novice Talker

Posts: 11
Trades: 0
please can someone help me (a newbie) with this, i need to show rows of dates with availability. also i would like a query where you can select a date and also select upto four weeks


$selectthedate = $_POST['selectdate'];
$selecttheweeks = $_POST['selectweeks'];

$query="SELECT * FROM table WHERE date ='". $_POST['selectdate'] . "' and availability = 'available'";


$result=mysql_query($query);
$sd=$selectdate;

if ( $sd == ($result['date']))
{
$date = $database->get_row(null);

echo "this date $date->is $availablility->book now!";
}
else
{
echo "Sorry. this date is fully booked.</br>";
}





--> database table has date and availability columns <--

many thanks in advance
ezhost is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-14-2004, 10:08 AM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
well you pretty much have the right idea.

Heres what I would do:

$selectthedate = $_POST['selectdate'];
$selecttheweeks = $_POST['selectweeks'];

$query="SELECT * FROM table WHERE date ='". $_POST['selectdate'] . "' and availability = 'available'";


$result=mysql_query($query);
if(!$result){
echo("error with query.");
exit;
}

if(mysql_num_rows($result)==0){
echo("No bookings...");
exit;
}

$row=mysql_fetch_array($result);

echo($row['date']." is ".$row['available']." Book now!";


As for the date up to for weeks. I have done this before but I am not sure how you are using your dates. But the query would be somthing likehtis

$query="SELECT * FROM yourtable WHERE date>=".$date1." AND date<=".$date2;

Hope this helps.
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Reply     « Reply to please help with query
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.70769 seconds with 12 queries