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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:24:08+00:00 2026-05-20T20:24:08+00:00

I am having difficulties with a MYSQl select statement. Is it possible to return

  • 0

I am having difficulties with a MYSQl select statement. Is it possible to return a value where the right value’s match. eg. I have a table.

id |   1   |   2   |   3   | etc. <--- COLUMNS
1  | Value | Value | Value | etc.
2  | Value | Value | etc.. 
3  | Value | Value |
4  | Value | Value |
5  | Value | Value | etc...

Im am trying through php to query the database to return value with.

$id = 3;
$inputvalues = "SELECT 'column'
FROM `DB`
WHERE `id` = $id
";

$return = mysql_query($inputvalues, $connection);


while ($r = mysql_fetch_array($return)){
$r[0]; 
echo "$loc = $row[3]<br />";

I think in theory this should work however all the returned value’s come back empty?

Is this possible?

  • 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-20T20:24:09+00:00Added an answer on May 20, 2026 at 8:24 pm

    You shouldn’t use single quotes (') around the column names, you can use backticks (`).

    SELECT column
    FROM `DB`
    WHERE `id` = '$id'
    

    or

    SELECT `column`
    FROM `DB`
    WHERE `id` = '$id'
    

    Put together:

    $id = 3;
    $sql = "SELECT column
            FROM `DB`
            WHERE `id` = '$id'";
    
    $return = mysql_query($inputvalues, $connection);
    
    while ($r = mysql_fetch_array($return)) {
      print_r($r);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django app that uses MySQL as a backend. I'm having difficulties
I'm having difficulties to display data from mysql database to PHP generated table. Interesting
I'm having real difficulties optimising a MySQL query. I have to use the existing
I having difficulties setting my footer properly. I have a Bottom navigation bar as
I'm having difficulties when trying to save huge images with C# (I'm talking about
I am having difficulties achieving Css 100% so my website can look right in
I'm having difficulties adding momentum to my spinning wheel. I have this wheel (something
I'm having difficulties reading an app.config using the ConfigurationManager. I have a custom section,
I'm having difficulties seeing why one way works and way doesn't. I have; switch
Im having some difficulties trying to order my list of a resultset. Im trying

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.