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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:07:20+00:00 2026-06-12T21:07:20+00:00

I have two tables in one database. id | title ——— // table name

  • 0

I have two tables in one database.

id | title
---------           // table name is tableone
1  |  a
2  |  b
3  |  c
4  |  d
5  |  a
6  |  b
7  |  c
8  |  d

for the first table the primary key is the ID column. from this table I am using PHP to create a HTML table which works fine.

The second table

id | version
---------
a  |  1
b  |  3
c  |  6
d  |  7

in the while loop for the first table I have predefined the title value as

$title = $id['title'];

within the while loop i am using another while loop yet this time I am trying to use the predefined title to access the matching id’s corresponding version row value on the second table using :

mysql_query("SELECT version FROM tableone WHERE ID=".$title)

however i am hinted with the error

Unknown column ‘a’ in ‘where clause’

what is the problem and how can i fix 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-06-12T21:07:21+00:00Added an answer on June 12, 2026 at 9:07 pm

    You should must enclose the $title in quotes like this:

    mysql_query("SELECT version FROM tableone WHERE ID='".$title."'")
    

    If you have user supplied input, you should make sure that your code is secure for all cases.

    In this post are some good informations about that: https://stackoverflow.com/questions/3714107/php-mysql-security-checklist-the-definitive-practical-guide

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

Sidebar

Related Questions

In a MySQL database I have two tables linked in a join. One table
What I have is two tables inside of a mysql database. One table contains
I have two tables one with ID and NAME table 1 ID | NAME
I have two tables in my MySQL database, one is a library of all
I have two related tables in my database: Page and Tag. One Page can
I have one database table TABLE_TIPS with two value 1. tips_id (auto increment) 2.
I have two tables : one table it matchs and the other is teams.
I have two MySQL database tables: one containing a list of championships and another
i have two tables in my database one is A other one is B
We have two Tables: Document: id, title, document_type_id, showon_id DocumentType: id, name Relationship: DocumentType

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.