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

  • Home
  • SEARCH
  • 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 512299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:18:20+00:00 2026-05-13T07:18:20+00:00

I have 5 game sections that will use the same template sheet, but they

  • 0

I have 5 game sections that will use the same template sheet, but they will all pull data from a different table in mysql in the same database. However, I am incorporating this: How to include config.php efficiently?

Okay, so here’s how I was planning to tackle it. For example, let’s say I go to index.php?page=pokemon then I was planning to set $game_name to $_GET[‘page’] and then use $game_name to select the table (assuming I made the table name pokemon) and then all the data would be pulled from mysql properly. Is there a better way I should do this?

Next, in the situation where someone tries to go to an non-existent game then I want it to redirect to the homepage. For example, let’s say they misspelled pokemon to poekmon and went to index.php?page=poekmon then it would properly show a blank template without data right? Instead, how can I make it just redirect to homepage if it was a game that doesn’t exist?

This is kind of similar to how wordpress is setup. It uses Single.php as a template and then grabs data from the database.

  • 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-13T07:18:21+00:00Added an answer on May 13, 2026 at 7:18 am

    Perform your logic before printing anything to the page itself, that way, if you decide the user has requested a game that doesn’t exist, you can simply redirect with the header();

    header("Location: homepage.php");
    

    As for finding out if the requested game exists, you can have a function that gets game-data, or returns false. That way, you can do something like this:

    if (!$data = game_data("pokemon")) header("Location: no-exist.php");
    

    If the requested game does exist, then the script continues, and you use $data to access the game data. Of course you’ll replace “pokemon” in the above example with your variable, after it’s been sanitized and prepped to be handled.

    Remember to do this before you output anything to the page itself, or else the call to header() will raise a “headers already sent” message.

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

Sidebar

Ask A Question

Stats

  • Questions 248k
  • Answers 248k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, there is way. You can use a issubclass function.… May 13, 2026 at 8:53 am
  • Editorial Team
    Editorial Team added an answer Create another form in JavaScript, and apply its submit() method… May 13, 2026 at 8:53 am
  • Editorial Team
    Editorial Team added an answer What language are you writing in, and how big is… May 13, 2026 at 8:53 am

Related Questions

I'm working in an openGL for iPhone , and although everything works great I
I have a list of articles, and each article belongs to a section. class
I have 5 columns corresponding to answers in a trivia game database - right,
Okay, so, this code is pretty basic. The user inputs an answer into a
I have a game that's based on a 25x20 HTML table (the game board).

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.