Jump to content

Time & verification help needed. Complicated (to me).


jamesxg1

Recommended Posts

Hiya guy's,

 

Been a while since iv been on here, how's it hanging round here then :) ?,

 

I have a really complicated query.

<select id="open" name="open" class="element select medium">
<option value="9:00" >9:00 AM</option>
<option value="10:00" >10:00 AM</option>
<option value="11:00" >11:00 AM</option>
<option value="12:00" >12:00 AM</option>
<option value="1:00" >1:00 PM</option>
<option value="2:00" >2:00 PM</option>
<option value="3:00" >3:00 PM</option>
<option value="4:00" >4:00 PM</option>
<option value="5:00" >5:00 PM</option>
<option value="6:00" >6:00 PM</option>
<option value="7:00" >7:00 PM</option>
<option value="8:00" >8:00 PM</option>
<option value="9:00" >9:00 PM</option>
<option value="10:00" >10:00 PM</option>
</select>
	<label class="description" for="element_3_7"><small>Open Shop At</small></label>
</div>


	<div class="right">


<select id="close" name="close" class="element select medium">
<option value="1:00" >1:00 PM</option>
<option value="2:00" >2:00 PM</option>
<option value="3:00" >3:00 PM</option>
<option value="4:00" >4:00 PM</option>
<option value="5:00" >5:00 PM</option>
<option value="6:00" >6:00 PM</option>
<option value="7:00" >7:00 PM</option>
<option value="8:00" >8:00 PM</option>
<option value="9:00" >9:00 PM</option>
<option value="10:00" >10:00 PM</option>
<option value="11:00" >11:00 PM</option>
<option value="12:00" >12:00 PM</option>
<option value="1:00" >1:00 AM</option>
</select>
	<label class="description" for="element_3_8"><small>Close Shop At</small> </label>
</div>


<div class="left">
<select id="sdtime" name="sdtime" class="element select medium">
<option value="1:00" >1:00 PM</option>
<option value="2:00" >2:00 PM</option>
<option value="3:00" >3:00 PM</option>
<option value="4:00" >4:00 PM</option>
<option value="5:00" >5:00 PM</option>
<option value="6:00" >6:00 PM</option>
<option value="7:00" >7:00 PM</option>
<option value="8:00" >8:00 PM</option>
<option value="9:00" >9:00 PM</option>
<option value="10:00" >10:00 PM</option>
<option value="11:00" >11:00 PM</option>
<option value="12:00" >12:00 PM</option>
</select>
<label class="description" for="element_3_"><small>Delivery Start Time</small></label>
</div>


	<div class="right">
<select id="stdtime" name="stdtime" class="element select medium">
<option value="1:00" >1:00 PM</option>
<option value="2:00" >2:00 PM</option>
<option value="3:00" >3:00 PM</option>
<option value="4:00" >4:00 PM</option>
<option value="5:00" >5:00 PM</option>
<option value="6:00" >6:00 PM</option>
<option value="7:00" >7:00 PM</option>
<option value="8:00" >8:00 PM</option>
<option value="9:00" >9:00 PM</option>
<option value="10:00" >10:00 PM</option>
<option value="11:00" >11:00 PM</option>
<option value="12:00" >12:00 PM</option>
<option value="1:00" >1:00 AM</option>
<option value="2:00" >2:00 AM</option>
<option value="3:00" >3:00 AM</option>
</select>

 

Them select boxes consist of four things,

 

Shop open time,

Shop close time,

Delivery start time,

Delivery end time,

 

 

I need it so that i can i can do the following,

 

Shop open time > Shop close time = ERROR

Shop open time < Shop close time = Continue

Delivery start time > Delivery start time = ERROR

Delivery end time < Delivery end time = Continue

Shop open time > Delivery start time = ERROR

Shop open time < Delivery start time = Continue

 

Ect ect, What do i do here to accomplish this ?,

 

Many many thanks,

 

James.

Link to comment
Share on other sites

Imagin this:

 

instead of the option values being "3:00" and so on. I would be just a number.

 

<select id="open" name="open" class="element select medium">
<option value="9" >9:00 AM</option>
<option value="10" >10:00 AM</option>
<option value="11" >11:00 AM</option>
<option value="12" >12:00 AM</option>
<option value="13" >1:00 PM</option>
<option value="14" >2:00 PM</option>
<option value="15" >3:00 PM</option>
<option value="16" >4:00 PM</option>
<option value="17" >5:00 PM</option>
<option value="18" >6:00 PM</option>
<option value="19" >7:00 PM</option>
<option value="20" >8:00 PM</option>
<option value="21" >9:00 PM</option>
<option value="22" >10:00 PM</option>
</select>

 

So then the SQL query would just be a simple comparison. What would be stored in the DB would just be numbers.

 

like:

 

delStart => 11

delEnd => 14

 

then you could compare them by loading those numbers into vars.

 

$delStart = $del->start;
$delEnd = $del->end;

then the math

if ($delStart < $delEnd)
{
//Continue
} else {
//Error!
}

Link to comment
Share on other sites

Imagin this:

 

instead of the option values being "3:00" and so on. I would be just a number.

 

<select id="open" name="open" class="element select medium">
<option value="9" >9:00 AM</option>
<option value="10" >10:00 AM</option>
<option value="11" >11:00 AM</option>
<option value="12" >12:00 AM</option>
<option value="13" >1:00 PM</option>
<option value="14" >2:00 PM</option>
<option value="15" >3:00 PM</option>
<option value="16" >4:00 PM</option>
<option value="17" >5:00 PM</option>
<option value="18" >6:00 PM</option>
<option value="19" >7:00 PM</option>
<option value="20" >8:00 PM</option>
<option value="21" >9:00 PM</option>
<option value="22" >10:00 PM</option>
</select>

 

So then the SQL query would just be a simple comparison. What would be stored in the DB would just be numbers.

 

like:

 

delStart => 11

delEnd => 14

 

then you could compare them by loading those numbers into vars.

 

$delStart = $del->start;
$delEnd = $del->end;

then the math

if ($delStart < $delEnd)
{
//Continue
} else {
//Error!
}

 

Perfect!.

 

Thanks dude.

 

Many thanks,

 

James.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.