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

The Archive Base Latest Questions

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

I have no idea why this isn’t working. I’ve taken code from a previous

  • 0

I have no idea why this isn’t working. I’ve taken code from a previous project that works fine. I just want to select specific columns. Here’s what im trying…

    $result = mysql_query("SELECT  when, where, name FROM tablename ORDER BY count DESC LIMIT 0, 20");

    //I dont really know how to debug php well, so this is all I have to go by to know if its not working.  
    if (!$result) 
    {
         echo "<p>Page load has failed please try again</p>";
    }

if I select all like this it works fine:

$result = mysql_query("SELECT * FROM tablename ORDER BY count DESC LIMIT 0, 20");

If im doing an insert, that doesn’t work either…

$query = "INSERT INTO tablename (when, where, name) VALUES ('$when' , '$where' , '$name');";
mysql_query($query);

I’m sure the spelling is correct i’ve looked at it several times, and even if I put

echo $row["name"]; and the others ect while using the select all * they appear...

It just seems like its happening when im selecting individual columns.

I have other tables, with other sites using the same exact code and its working fine.

How can i fix this? or at least how can i debug the php to get some better error messages?

edit:
I’m sure the values going in are good, its just simple helloworld string
I’ve tried including count in the select incase that needed to be there for the sort, but that didnt make it work.

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

    The word where is a reserved word (the WHERE clause of SELECT, UPDATE and DELETE queries). So is when. count is a built-in function name but can be used as an identifier, though you shouldn’t.

    If you use it as an identifier, you must always enclose it in `backticks` in the query. I recommend not using parts of the query language as column names.

    http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html

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

Sidebar

Related Questions

Anybody have any idea why this query isn't working? $result = mysql_query(SELECT * FROM
I have no idea what this means. But here is the code that it
Anyone have any idea why this isn't working? $(function(){ console.log('ready'); $.ajax({ dataType : 'jsonp',
I have no idea why this isn't working. NSData *data = [NSData dataWithContentsOfURL:place.iconData]; UIImage
I have no idea why this isn't working, but I can't seem to get
I have no idea why this is happening. I have some very straightforward code,
I have no idea how this works or if it is even possible but
I have absolutely no idea why this is happening but the following code seems
For whatever reason, this little piece of dojo isn't working. I have to admit
I have this idea for a free backup application. The largest problem I need

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.