this should be simple for someone who knows php well..

ok below is my form for making an appointment…


Book an appointment @ K9CLUBHOUSE DOG HOTEL
<form action="book.php" method="POST" id="insert">

nnnnnnnnnnnnnnnnnxxxxxxxxxxxxxxxx

First Name xxx Last Name

Address

<input name="address" type="text" id="address" size="50" />

City xxxState xxxZip Code

Home Phone xxx Cell Phone
-----------.---(example 555-555-5555)---------------------(example 555-555-5555)

Email Address

Dog's Name Male Female

Dog's Breed

Drop Off Date Pickup Date
----------------------------------------------------------------...--(example 03/15/2012)---------------------(example 03/15/2012)--.--------------------------

- -Is your dog People Aggressive ? Yes No

---Is your dog Other Dog Aggressive ? Yes No

---Is your dog Food Aggressive ? Yes No

- -Is your dog Spayed / Neutered ? Yes No

 

**ATTENTION**
After submitting this form by pressing the "Book My Appointment" button
below, you will be required to pay a $30.00 non refundable booking fee per pet, per appointment.
So please have your Visa/Mastercard/AMEX/Discover or Paypal information ready
before proceeding. Thank you.

 

BOARDING HOURS FOR DROP OFF OR PICK UP:

MONDAY—FRIDAY…………. 9:00 a.m.— 8:00 p.m.
SATURDAY…………………… 9:00 a.m.— 6:00 p.m.
SUNDAY………………………10:00 a.m.— 5:00 p.m.
HOLIDAYS  …………………..10:00 a.m.— 2:00 p.m.

DOGGIE DAYCARE HOURS :

MONDAY—FRIDAY…………. 6:00 a.m.— 8:00 p.m.
SATURDAY…………………… 9:00 a.m.— 6:00 p.m.
SUNDAY………………………10:00 a.m.— 5:00 p.m.
HOLIDAYS……………………...... Sorry, No Daycare

2012 PRIME NIGHTS

JANUARY 1 — JANUARY 2
FEBRUARY 17 — FEBRUARY 26
APRIL 6 — APRIL 14
MAY 25 — MAY 28
JULY 3 — JULY 8
AUGUST 31 — SEPTEMBER 3
NOVEMBER 21— NOVEMBER 25
DECEMBER 21— DECEMBER 31

2013 PRIME NIGHTS

JANUARY 1


** Proof of vaccinations: Rabies, Parvo-Distemper (DHLPP), and Bordatella is mandatory at time of drop off.**

Special Instructions

 

_______________________________

Now below is my action for the above form.

<?php // contact to database $connect = mysql_connect("localhost", "boulder7_admin", "someone552083") or die ("Error , check your server connection."); mysql_select_db("boulder7_testdb"); ____________________ this part is where I need help.. I need this following little statement underneath in red to do this: I need this little statement to first query the database and ask the database to SELECT and bring back all the rows that have a dropdate or pickup date between the dropoff date and pickup date the user has entered in the form, if the amount of rows brought back is less than 29 then it continues with the action below however if the amount of rows brought back is more than 29 it needs to simply print a message stating someone will contact them back as all rooms are booked. CAN SOMEONE PLEASE HELP ME IM GOING CRAZY TRYING TO GET THIS TO WORK AND IT HAS TO BE DONE TOMORROW MORNING!! :(( mysql> SELECT * FROM contact WHERE -> dropdate BETWEEN $v_dropdate AND $v_pickupdate -> pickupdate BETWEEN $v_dropdate AND $v_pickupdate ____________________ //Get data in local variable $v_firstname=$_POST['firstname']; $v_lastname=$_POST['lastname']; $v_address=$_POST['address']; $v_city=$_POST['city']; $v_state=$_POST['state']; $v_zip=$_POST['zip']; $v_homephone=$_POST['homephone']; $v_cellphone=$_POST['cellphone']; $v_email=$_POST['email']; $v_dogname=$_POST['dogname']; $v_male=$_POST['male']; $v_female=$_POST['female']; $v_dogbreed=$_POST['dogbreed']; $v_dropdate=$_POST['dropdate']; $v_pickupdate=$_POST['pickupdate']; $v_ppl_aggr_yes=$_POST['ppl_aggr_yes']; $v_ppl_aggr_no=$_POST['ppl_aggr_no']; $v_dog_aggr_yes=$_POST['dog_aggr_yes']; $v_dog_aggr_no=$_POST['dog_aggr_no']; $v_food_aggr_yes=$_POST['food_aggr_yes']; $v_food_aggr_no=$_POST['food_aggr_no']; $v_dog_fixed_yes=$_POST['dog_fixed_yes']; $v_dog_fixed_no=$_POST['dog_fixed_no']; $v_instructions=$_POST['instructions']; // check for null values if ($v_firstname=="" or $v_lastname=="") echo "All fields must be entered, hit back button and re-enter information"; else{ $query="insert into contact(firstname,lastname,address,city,state,zip,homephone,cellphone,email,dogname,male,female,dogbreed,dropdate,pickupdate,ppl_aggr_yes,ppl_aggr_no,dog_aggr_yes,dog_aggr_no,food_aggr_yes,food_aggr_no,dog_fixed_yes,dog_fixed_no,instructions) values('$v_firstname','$v_lastname','$v_address','$v_city','$v_state','$v_zip','$v_homephone','$v_cellphone','$v_email','$v_dogname','$v_male','$v_female','$v_dogbreed','$v_dropdate','$v_pickupdate','$v_ppl_aggr_yes','$v_ppl_aggr_no','$v_dog_aggr_yes','$v_dog_aggr_no','$v_food_aggr_yes','$v_food_aggr_no','$v_dog_fixed_yes','$v_dog_fixed_no','$v_instructions')"; mysql_query($query) or die(mysql_error()); echo "Your appointment has been booked, Please confirm the booking by paying your $30 deposit by clicking here>>"; } ?>

It may be the format of the date. Are you inserting the date as text?

Maybe reformat the date or select dates from a drop down menu, etc. before comparing them. Hope this helps.

Not sure, but, assuming you are asking for how to execute the query to pull that data.
Something like this would probably work. I have note tested it as I do not have a database
set up with your tables, etc… Hopefully, you will understand how to handle the data that is
pulled back from the query. If not, look at PHP.net for how to pull records from queries or ask here.
If you ask here, please place code into PHP brackets above so we can copy it easier. And, we do not
need to see all your code, only the parts that pertain to your question… Try this and see if you can figure it out:
[php]

<?PHP $query="SELECT * FROM contact WHERE dropdate BETWEEN '" . $v_dropdate . "' AND " . "'" . $v_pickupdate . "', pickupdate BETWEEN '" . $v_dropdate . "' AND . ' . $v_pickupdate . "'"; $rows=mysql_query($query) or die(mysql_error()); // $rows now equals all data, use a while or for loop to parse thru the data rows... // Each row contains all the fields in each row from the recordset... ?>

[/php]
NOTE: Be careful with the quote - doublequotes… To build a query string, you normally place your data such as pickupdate=“xyz” into your query, but, you have to watch out for how it is formatted. If the “outside” quotes are double-quotes, the inside quotes should be single quotes. So, in my example, it shows double-quotes outside of ALL strings and data are PHP variables, so inside the strings are starting and ending single-quotes used to create the pickupdate=‘xyz’ inside of the query. Hope that makes sense… Hope that is what you were asking… Good luck…

Sponsor our Newsletter | Privacy Policy | Terms of Service