Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieving database record to use in PHP code
    primarykey
    data
    text
    <p>I am making code for a studio reservation where customers can reserve for how many hours in a day... for example, a customer inputs Date: October 17, 2011 Time In: 10:30:00 am Time out: 11:30:00 am</p> <p>In that case, another customer must not be able to input a time in/ timeout between 10:30 to 11:30 am with the same date.</p> <p>before making a database, i have tried this code:</p> <pre><code>&lt;?php $resttimefrom='10:00:00 am'; $resttimeto='11:00:00 am'; $reserve='11:01:00 pm'; $datedat='2012-10-14'; $st_time = strtotime($resttimefrom); $end_time = strtotime($resttimeto); $reserve = strtotime($reserve); $datedat = strtotime($datedat); print $st_time; echo "&lt;br&gt;"; print $end_time; echo "&lt;br&gt;"; print $reserve; echo "&lt;br&gt;"; if ($reserve =&gt; $st_time and $reserve =&lt; $end_time) { echo "sorry, not available"; } else { echo "ok!"; } ?&gt; </code></pre> <p>it can already restrict the time, but not yet the day.</p> <p>it's just a sample so that I will know what to do if i'll transfer it into database.</p> <p>my problem is this:</p> <p>I have a table named reserve with 3 columns... timein, timeout, dateres three records have been inputted,</p> <p>October 15, 2011, 10:30-11:30 October 15, 2011, 1:00-2:30 October 15, 2011, 5:30-8:30</p> <p>how can I retrieve these records to use it on my code above? instead of these:</p> <pre><code>$resttimefrom='10:00:00 am'; $resttimeto='11:00:00 am'; $reserve='11:01:00 pm'; $datedat='2012-10-14'; </code></pre> <p>how can I change 10:00:00 am to all records in my database?</p> <p>I have very limited knowledge about php and mysql... :( please someone help me. please please please</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload