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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:47:20+00:00 2026-05-22T23:47:20+00:00

EDIT: I had a typo in my original post….the issue is a bit more

  • 0
EDIT: I had a typo in my original post....the issue is a bit more complicated...i had a variable passed in not a raw string.

I want to print out stories from a mysql database that are specific to a certain person:
so i have code that is similar to:

$stuff ="jamie"
    $query = "SELECT * FROM person_stories WHERE person =$stuff";
    $result = mysql_query($query) or die ("didnt work");
    while($row = mysql_fetch_array($result))
    {
    echo "<a href = 'PersonStoryPage.php?pid=$row[id]'>" .$row['title']. " </a>";
    }

I keep on getting “didnt work” …I know that my table person_stories is empty but is this the same thing as an error? The table will obviously not always be empty so I need to be able to use this block of code to go about business.

Help is appreciated!

EDIT 2: The actual error is:

Unknown column 'jamie' in 'where clause'

This is bizzare since it shouldn’t be interpreting jamie as the column!

  • 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-22T23:47:20+00:00Added an answer on May 22, 2026 at 11:47 pm

    You didn’t put single quotes around jamie. Try this:

    $query = "SELECT * FROM person_stories WHERE person = 'jamie'"
    

    Edit:

    I see the post has been edited. It should now change from this:

    $stuff ="jamie"
    $query = "SELECT * FROM person_stories WHERE person =$stuff";
    

    to something like this:

    $stuff ="jamie"
    $query = "SELECT * FROM person_stories WHERE person='" . mysql_real_escape_string($stuff) . "'";
    

    This will not only solve your SQL syntax error, but also protect your app from a nasty SQL injection vulnerability.

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

Sidebar

Related Questions

edit I'm a fool and had a typo in my controller, it's all good
EDIT: I had hex value(string) that i converted to a Brush hence it did
EDIT: I had hex value(string) that i converted to a Brush hence it did
EDIT: I had made a mistake during the debugging session that lead me to
Answer solved in edit below I had this piece of code Dictionary<Merchant, int> remaingCards
I posted another one on this,, but i had to edit it really much...
EDIT: Now a Major Motion Blog Post at http://messymatters.com/sealedbids The idea of rot13 is
EDIT: This post was originally specific to ASP.NET, but after thinking about it I'm
EDIT I had a problem a while ago writing a program in C which
Edit: I had some code posted here but I couldn't get it to reproduce.

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.