Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3597848
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:10:11+00:00 2026-05-18T20:10:11+00:00

I have several pages that access my data-base directly and get values from a

  • 0

I have several pages that access my data-base directly and get values from a table.

Now depending on the users Geo location, we want to return a different value.

I have a PHP script that gets the geo location, but I am trying to figure out a way to avoid tracking down every page that accesses the data-base to add this logic.

I realize if the site was using an MVC architecture I could just add the logic to the model. Unfortunately that is not the case.

So my question is, is my only option to add this logic to every page that accesses that data from the DB. Or is there a better way I am unaware of?

P.S. My question title probably isn’t the best description of my problem but I was unsure how to word it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:10:12+00:00Added an answer on May 18, 2026 at 8:10 pm

    You need not add the detection logic to every page that accesses the data, but to a common page, say index page. Are you having a common page?

    Like webbiedave has said, you will have to apply some changes to your query to alter the data.

    I have implemented user location based data display in one project. We had to display a list of online classes that will be taken by some tutors. The list of classes is displayed depending on the browser’s/registered user’s geo-location (country). User region (inside a country I guess) will not change the basic logic for doing this. We also did not use any framework, so I think this may be useful for you:-

    This is roughly what we did:-

    1. Geo location manipulation part –
    We have an index file (like a front controller of a framework) which is run for every request (for every module) which has all the user geo-location manipulation related code.
    Following are the main points about that manipulation code-
    – we used a php library to do the detection
    – Detect the user location (country in our case) and store it in session.
    – Do not detect again/everytime if already stored in session.
    – clear stored geo location on user logout and detect again.

    2. Location dependent condition to your queries
    – Now you just have to add the detected location to your query in one place, put it inside a function, add a location parameter to it and call it from your module. Reuse the function as much as possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several pages that access my data-base directly and get values from a
I have several aspx pages that can be opened either normally (full screen in
I have several web pages on several different sites that I want to mirror
Good morning. I have several pages with content that correspond to some products details.
I have several JSP files that are included into other JSP pages. Some of
I have a script that fetches several web pages and parses the info. (An
I have a login page that has several textboxes on the page, one of
Imagine that you have several links on a page. When you clicked, a div
I have several wpf pages with update/delete/add buttons. I want to display to the
I have a page with several controls. The controls are bound to display values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.