?
Solved

Adding searchable opening times on e-directory

Posted on 2010-08-20
10
Medium Priority
?
297 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
[X]
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
10 Comments
 
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.
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 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.

0
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

 

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 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?  
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 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:
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 111

Accepted Solution

by:
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.
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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