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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:12:00+00:00 2026-06-10T01:12:00+00:00

<?php $id = $_GET[‘id’]; $query = SELECT doc FROM docs WHERE id = ‘$id’;;

  • 0
<?php
    $id = $_GET['id'];
    $query = "SELECT doc
    FROM docs
    WHERE id = '$id';";
    $doctext = mysql_query($query);
?>

I’m new to PHP/MySQL and am unsure what is going wrong. The code above is supposed to get the id from the URL, which works fine, then select the doc–which is a column of data adjacent to the id column–from the table docs which matches the given $id value.

However, instead it just returns “Resource id #11”, which makes me think that I’m mixing up the SELECT, FROM, and WHERE keywords somehow, because it’s not giving an error, just the wrong data.

Why is this happening 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-10T01:12:01+00:00Added an answer on June 10, 2026 at 1:12 am

    Your query is executing fine. Your issue is that you aren’t retrieving any data from the result. The mysql_query function doesn’t automatically retrieve data, you retrieve it in a format you desire using one of the mysql_fetch functions like mysql_fetch_row.

    Note that you really shouldn’t be using the ancient MySQL api, and should be using PDO (or MySQL). Also, your code is vulnerable to SQL injection and you should use bound parameters, a feature of MySQLi and PDO.

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

Sidebar

Related Questions

I'm trying to remove a PHP Get query from my domain. For example, instead
Im using this PHP to get a list of Title's from an RSS feed:
Possible Duplicate: PHP REGEX: Get domain from URL I am working on a project
I am trying to send data from an Android app to a PHP file
Here is how I am currently counting mysql rows in PHP: //GET total #
I want to call Java from PHP 5.2, running either on a webserver or
Hy! I want to make a autosuggest from my php file that returns a
I know you guys going to say this might be possible duplicate to PHP
I'm making a PHP and MySQL RPG game, and my changeEquipment page is not
I am receiving a JSON object from a PHP get request. It looks like

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.