[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Adding searchable opening times on e-directory

Posted on 2010-08-20
Medium Priority
Last Modified: 2013-12-13
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.

Question by:Kevin2010
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
LVL 111

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.

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

Author Comment

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.

LVL 111

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.

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.


Author Comment

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.
LVL 111

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?  

Author Comment

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.
LVL 111

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:

Author Comment

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.

LVL 111

Accepted Solution

Ray Paseur earned 1500 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.

Best of luck with it, ~Ray

Author Closing Comment

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.


Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
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 …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

649 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