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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:19:17+00:00 2026-05-13T16:19:17+00:00

I have this db below. I wonder how I should use the ID to

  • 0

I have this db below. I wonder how I should use the ID to identify each record.
Everything is connected from the classified_table!
Two Questions:

Should I use AI on every PK in this case?

Could somebody give me the FULL code for selecting an entire classified from only an ad_id (“bmw_330ci_8939483” for example)?

I am new to normalized db and making a good database work, so detailed instructions is very much appreciated… Also if you notice any ‘wrongs’ in this db please let me know.

category table:
cat_id (PK)
cat_name

category_options table:
option_id (PK)
cat_id (FK)
option_name

option_values table:
value_id (PK)
option_id (FK)
value

classifieds table:
classified_id (PK)
ad_id (VARCHAR) something like "Bmw330ci_28238239832" which will appear in URL
poster_id (FK)
cat_id (FK)
area_id (FK)
headline
description
price
etc....

posters table:
poster_id (PK)
name 
email
tel
password

area table:
area_id (PK)
area
community

Thanks

  • 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-13T16:19:18+00:00Added an answer on May 13, 2026 at 4:19 pm

    I would auto-increment (AI) on fields that I would do majority of searching by. AI makes it easier to return results, but there are performance issues where it can slow down the database.

    In regards to the query, I am not exactly sure what you would want to return, but this query returns the classified_id by the given ad_id

    SELECT classified_id FROM classifieds_table WHERE ad_id = "bmw_330ci_8939483" 
    

    To perform a single insert into your classifieds table and column ad id the value audi a4 would be:

    INSERT INTO classifieds_table ad_id VALUES "audi_a4"
    

    Or multiple inserts using the same table, multiple fields and multiple values would be:

    INSERT INTO classifieds_table (ad_id, poster_id) VALUES ("audi_a4", 10)
    

    Notice I left out classified_id because if you choose to auto-increment it will automatically assign a value without you explicitly assigning one.

    Check out MySQL :: Building a Database-Driven Website using PHP and MySQL for more tutorials.

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

Sidebar

Related Questions

I have this code below. I need to use a class id instead of
I have this code below. As you can see I am passing two variables
Hi I have this method below which should insert values into my database. However
I have this code below where I loop through string and compare everything char
In the image below I have a search results from Google. I wonder what
I have this below code and it work fine header (content-type: text/xml); $xml =
I have this line below that shows a link to go the next page
I have this code below: $insert = array(); for ($i = 1, $n =
I have this object below: I thought about putting the messages in html like
I have this javascript code below that uses jquery, it is suppoed to be

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.