I am using the UserFrontEnd Pro plugin for my Wordpress website. I created a new Registration form, I added a DateTime field and an age field (age field should be uneditable), so what should happen is when the user selects a particular date, the age should be automatically calculated as soon as the user selects a date and display it in the age field.
So, basically age should be calculated and displayed as soon as the user selects a date.
Thanks in Advance!
Related
I want to compare date inserted in textbox with date from MYSQL database.
My idea is to make car rent form (with FROM date - TO DATE), and after submiting that form, query will check if it is possible to rent that specific car in that period. Anyone had anything similar?
Thanks
We run many queries that are Start and End Date dependent.
SELECT * FROM rentCar
WHERE textBox BETWEEN StartDate AND EndDate
I'm a WP newbie and am amazed so far by what it can do. I am currently using Gravity forms to charge my customers for a monthly subscription plan. However I give my users option to choose the months they want to enrol for and charge them for it as they enrol.
FromDate = Date entered by the user in From Date field (in days)
ToDate = Date entered by the user in To date field (in days)
So my formula for price calculation is:
(ToDate - FromDate)* (cost per day of my subscription)
However, I don't know how to implement this. Any help would deeply be appreciated.
The Gravity Forms Date Time Calculator plugin will allow you do to all sorts of date-based calculations. It's available by request to Gravity Perks users.
I'm making website for Hotel Reservation System. I need help about the query, I was searching through post but i didn't find solution that will work for me.
In my DB i have table booking, with check in and check out date that need to be checked by the query when the user input check in and check out for specified room. Here is my query:
SELECT * FROM booking WHERE room='$room' and ((checkin>='$cIN' and checkout<='$cOUT' )or(checkin<='$cIN' and checkout>='$cOUT'))
'$cIN' and '$cOUT' are the inputs from user for check in and check out.
My query in some cases work, lets say for example the room is booked from 15/03/2017 to 20/03/2017, when the new user input 13/03/2017 to 17/03/2017 then the query dont return any results, and the user can book the same room. So in this case we have 2 users in one room in same interval of time. I need to restrict this kind of reservations. Thanks in advance.
To find an overlap we need to search for items where requested checkin is before an existing checkout AND the requested checkout is after the existing checkin.
-- Return existing bookings that overlap the requested date range
SELECT *
FROM booking
WHERE room = '$room'
and checkin <= '$cOUT' and checkout >= '$cIN'
Simpler than you thought :)
Note that this query will not allow a new booking to checkin at the same time that a previous booking checked out. If your checkin/out fields do no store time then you will need to alter this logic to use <,> instead of <=,>=
this is my logic, the query is to check your checkin date between the checkin date and the checkout date in the database, also check the checkout date between the checkin date and the checkout date in the database. If there is a database row, your checkin or checkout date is not available.
SELECT * FROM reservasi WHERE (
'$checkin' BETWEEN checkin_date AND checkout_date
OR '$checkout' BETWEEN checkin_date AND checkout_date)
-->num_rows
Additionally, if one room class has many rooms then check first room with the class id.
If there is no database row, then room is not available.
SELECT * FROM room WHERE class_id='$class_id' AND status='available'
Using CakePHP3,I'm having trouble figuring out how to save the current DATE in (year, day, month) format. I'm using mySQL as the database, and I have a users table with a created_at column with type DATE. When a user registers, how do I save the current date along with all the other entity data? I've been looking around but the CakePHP Cookbook is a little unclear.
change the datatype of created_at to TIMESTAMP and set the default value to CURRENT_TIMESTAMP on the field settings.This should allow mysql to automatically set the current server date and time for you everytime a new record is created.
No code required!!!
I'm totally new to php & mysql,
When I'm creating one trial application using php ,there is problem specify below,
I want to hide the details of record (of database) from user when date will be expired using php ,
When one user logedin & create one record entry that time automatically current date is also entered in database, but I want to give 1 week expiry date, after that the record will be not shown to the front end but it available in database. When the creator of this record renew this recod that time automatically date should be updated at current date, & same record will be shown as new entry
PLz help me,
I'm waiting for ur answer,
Thanks in advance.
What kind of column is the date one? Timestamp? or timedate?
Either way, you can do it like so (depending on your column type)
For timedate:
WHERE (date + INTERVAL 1 WEEK) < CURDATE()
For timestamp:
WHERE (timestamp + 604800) < UNIX_TIMESTAMP()
Let me know what you are using for your date column and I can update. You can also see the MySQL date functions here.