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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:52:08+00:00 2026-06-12T07:52:08+00:00

I’m working in PHP and MySQL I feel like punching a wall. I have

  • 0

I’m working in PHP and MySQL

I feel like punching a wall. I have no idea how to do this and it’s making me angry. I’ve done plenty of things like it before and this isn’t working. UGH. Please help!!!!

I’m doing a search. Customer will type in something like “88 brake pads”. I want to return all the parts that say “brake” all the parts that say “pads” and all the parts that have the year 88. My issue here is, the years and the parts are in different tables.

Example:

Years Table

  ID  |  part_id  |  year  |
============================
   1  |    15     |  1945  |
   2  |    15     |  1946  |
   3  |    16     |  1984  |
   4  |    18     |  1987  |

Parts Table

  ID  |  part_name  |
=====================
  15  |    brakes   |
  16  |     hose    |
  17  |    crank    |
  18  |    muffler  |

This SQL Works, when pulling out of parts table

SELECT DISTINCT * FROM hj_parts WHERE part_name LIKE "%brakes"

I will get the output

  ID  |  part_name  |
=====================
   15  |    brakes   |

So what I need is if someone enters “brakes 87” I want to get back all the info for part 15 (brakes) and part 18 (because it’s from 1987).

I am so totally lost.

I’ve done something like this to pull out all the parts from a certain year, and I thought I could just tweak it, and it’s not helping.

$query = "SELECT hj_parts.* FROM hj_parts JOIN(SELECT DISTINCT part_id FROM hj_years WHERE (year BETWEEN $starter AND $ender) OR (year='all')) hj_years ON hj_parts.id = hj_years.part_id";
  • 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-12T07:52:09+00:00Added an answer on June 12, 2026 at 7:52 am

    Here’s how I’d do it. First create a query that brings everything together, and we’ll put it in a view for convenience sake

    create view AllParts as 
    SELECT Parts.*,Years.* from Parts inner join Years on Years.part_id=Parts.ID
    

    Then you do a search like this

    Select * from AllParts where part_name like '%brake' or year=1987
    

    If your database is big this might take a while. It’s not necessarily a perfect solution, but it can work for you.

    If you are interested in doing a keyword search, perhaps a nosql database would be better

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
This could be a duplicate question, but I have no idea what search terms
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.