Solved

Adding searchable opening times on e-directory

Posted on 2010-08-20
10
293 Views
Last Modified: 2013-12-13
Hey
Hope all is well.
I have another e-directory problem.

I need to add an option for the client to add their opening times for each day, from their account, which can be searched by the frontend user.

So I'm guessing the best way to go about it is in the backend have the 7 days listed with a list of 3 times where the user can put in opeing times.

So like:
 Monday:    8:00 - 12:00
                 13:00 - 17:00
                 18:00 - 22:00

I think the best optionfor that would be drop down menus for each time.

Then on the front end have drop down menus for each option so drop down for days then open and close.

I am not sure how to go about doing this.
I'm open to suggestions about how to lay it out and work.

I'm not sure which files I need to edit or how to get it to write to the table to make it searchable from the front end.

I went into the phpadmin and I've attached the exports from the database tables.

This is a link to the front of the site http://whatsopenuk.com/ .

Any help or suggestions would be great.

Thanks in advance.


whatsope-edirectory.sql
whatsope-edir7400.sql
0
Comment
Question by:Kevin2010
  • 5
  • 5
10 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 33483315
For starters, I can offer some general guidance on how to handle DATETIME information in PHP and data bases.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

Can you be a bit more specific about the question?  Thanks, ~Ray
0
 

Author Comment

by:Kevin2010
ID: 33483368
Thanksfor that. I'll have a read up on that.

Sorry about that what it is I'm not sure how to add the options for the advertiser/clients to enter the opening times for specific days. Then from the front end allow the user to search through the database after selecting specific times and days.

Thanks
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 33484078
Generally, business opening and closing times are set according to the days of the week.

To find if a business is open "now" you would query the data base for all the Friday records and look to see if "now" is between any of the opening and closing times.

You could use Javascript and AJAX and make this complicated with dropdown select lists, but a simpler design might be to list the days of the week and allow the client to type in the opening and closing times.  You can use strtotime() to evaluate the client input.  I would think that three sets of opening and closing times would be enough.

0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:Kevin2010
ID: 33484981
Thanks for your reply.

That would be for the backend yeah?
So strtotime() would store it?

I was considering the dropdown for the frontend of the site just for the day. I thought that might be easier to check the database with. Then have two fields for the user to type in two times which would search the database for businesses open during that period.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 33485046
Strtotime() converts human-readable DATETIME strings into UNIX timestamps.  If strtotime fails, the string is not usable as a DATETIME value.

You use strtotime() and date() together to manipulate DATETIME strings.

So if I wanted to tell you a time, I could use something like this: 8:30 a.m. or 0830 or 3:00pm or 15:00:00.  These would all work.  If I said, "one hour ago" it might work.  there is great flexibility.

Can you tell me a little more about the search you want to offer the clients?  
0
 

Author Comment

by:Kevin2010
ID: 33485275
Oh ok thanks

I want to allow users the option to search for a specific business at a certain time of a specific day.

So say I want to go to a resturant tonight at 9pm. I'd go on there type resturant then area then select Friday  then type 9:00pm - 10:00pm

So the results would come back with all the resturants open between 9:00pm and 10:00pm on Fridays near/in the area I want.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 33485379
Got it - that makes sense.  I would just use text fields for the times with a default value of "now".  Probably a SELECT dropdown for the business type.  Probably a text field for the day, with a default value of "now".  IIRC "now now" works with strtotime.  You can test on my web site here:
http://www.laprbass.com/RAY_strtotime.php
0
 

Author Comment

by:Kevin2010
ID: 33485598
Thanks for this.
I'll have a go at trying to implement that.
Currently on the frontend it just as a box for you to type a keyword so you recommend a select drop down instead.

If I do that in the backend I'd have to give the same options for the advertiser(the person who is adding their business to the directory) to select their business type?

How would I go about adding that as well as their opening time to get them added to the database.


0
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 33485850
Based on that question, I think you might want to hire a developer.  What you're describing is not "hard" or anything - it's just a lot of application design and data base normalization work.  If you're relatively new to PHP and MySQL, this book might be helpful.
http://www.sitepoint.com/books/phpmysql4/

Best of luck with it, ~Ray
0
 

Author Closing Comment

by:Kevin2010
ID: 33486347
Thanks for all your advice on this and quick responses.
I really appreciate your advice and will look into getting the book you reccomended and hiring a developer.

Thanks
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question