Solved

Adding searchable opening times on e-directory

Posted on 2010-08-20
10
292 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 108

Expert Comment

by:Ray Paseur
Comment Utility
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
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
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
 

Author Comment

by:Kevin2010
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Kevin2010
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
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
Comment Utility
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 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now