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 9152569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:05:05+00:00 2026-06-17T12:05:05+00:00

I currently have this code. switch($search_topic) { case ‘Title’: $stmt = $dbh->prepare(SELECT game_id, title,

  • 0

I currently have this code.

            switch($search_topic)
            {
                case 'Title':
                    $stmt = $dbh->prepare("SELECT game_id, title, platform_name, author_name, price
                                            FROM games 
                                            WHERE title 
                                            LIKE :search_term");
                break;

                case 'Platform':
                    $stmt = $dbh->prepare("SELECT game_id, title, platform_name, author_name, price
                                            FROM games 
                                            INNER JOIN platforms ON games.platform_id = author.platform_id
                                            WHERE platform_name LIKE :search_term");
                break;
            }

the search_topic variable is coming from a listbox on the previous webpage, the Title search works correctly as its simply just search one MySQL table. The Platform search is being abit difficult as I’m attempting to search multiple tables, If that makes sense.

The games table has a column called “platform_id” this this links to the platform table where the key field links to what platform it is under. So how would I go about getting the “platform_id” from the games table and then link it to the “platforms” so I retieve the “platform_title” and then use that to search against.

Schema: http://sqlfiddle.com/#!2/3d3e3/6

  • 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-06-17T12:05:07+00:00Added an answer on June 17, 2026 at 12:05 pm

    Based off of your fiddle, here’s the update for you:

    SELECT g.game_id, g.title, p.platform_name, a.author_name, g.price
    FROM games g
    INNER JOIN platforms p ON p.platform_id = g.platform_id
    INNER JOIN author a ON a.author_id = g.author_id
    WHERE g.title LIKE 'Skyrim';
    

    You would obviously change WHERE g.title LIKE 'Skyrim'; to whichever field you would like to filter on. So the platform query would be:

    SELECT g.game_id, g.title, p.platform_name, a.author_name, g.price
    FROM games g
    INNER JOIN platforms p ON p.platform_id = g.platform_id
    INNER JOIN author a ON a.author_id = g.author_id
    WHERE p.platform_name LIKE 'Xbox';
    

    I would also suggest that you change your CHARSET to utf8 instead of latin1, assuming this reflects your production database setup.

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

Sidebar

Related Questions

Currently I have the following code: switch (publicationType) { case PublicationType.Book: return Session.Query<Publication>() .Where(p
I currently have this code which stores XML into an XML-type column called data,
I currently have this code: PACKETS = {}; function AddPacket(data) local id = data.ID;
I currently have this code : Private Sub Worksheet_Change(ByVal Target As Range) Dim lastrow
I currently have this code Private Sub Worksheet_Change(ByVal Target As Range) WorksheetChanged(Target, Range(AB3).CurrentRegion, Range(B18:B19))
I currently have this code which reads the first field in a database record
Ok I currently have this code public int i = 0; //this is outside
Hello I currently have this code checking if a cookie exists, it works all
Currently I have this code: <?php echo '<meta name=robots content=noindex>'; $arr = json_decode(file_get_contents(http://media1.clubpenguin.com/play/en/web_service/game_configs/ paper_items.json),true);
Currently I have this code var App = Ember.Application.create(); App.user = Ember.Object.create({ people: customers

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.