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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:33:16+00:00 2026-06-07T01:33:16+00:00

For some reason, some of my SQL queries seem to be handling numbers oddly.

  • 0

For some reason, some of my SQL queries seem to be handling numbers oddly. For instance, in my mySQL database I have a table called users with an INT(11) field called points. When I try to retrieve this field, sometimes it returns correctly, and other times it returns null. This query returns "User fMcBBx has points according to database" every time:

$query = "SELECT points FROM users WHERE user_id = '$this->getID()'";
    $result = DBCore::call()->fetchRow($query);
    echo "User {$this->getID()} has {$result['points']} points according to database";

While this one from my constructor returns the number correctly every time, such as "User fMcBBx has 1050 points according to database":

SELECT first,
       last,
       email,
       points,
       level,
       gender
FROM users
WHERE user_id = '{$this->id}'

I haven’t found any patterns in the queries that do and don’t return this field correctly. I’ve checked all of them by running them against the database in PHPmyAdmin to make sure they all worked, and I’ve echoed all of the input values to make sure they are being transferred correctly. Why might I get nulls on some queries but not others?

  • 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-07T01:33:19+00:00Added an answer on June 7, 2026 at 1:33 am

    When I put braces around the function call in the first query, $query = "SELECT points FROM users WHERE user_id = '{$this->getID()}'";, it works perfectly. Php can’t evaluate function calls inside double-quoted strings the way it can read variables, putting curly braces around the function call allows it to evaluate the function call correctly.

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

Sidebar

Related Questions

For some reason I'm not able to install a separate SQL Server instance on
I have an application using Spring with Hibernate on a MySQL database. For some
This evaluation in sql doesn't seems to work properly for some reason but i
i already had 2008 express sql server but for some reason it came without
For some reason there's a variable called d that is defined immediately after I
I found a some post about difficulties found on logging sql queries when using
Some of the queries I have written inside MS-Access are getting deleted automatically. And
For some reason I have to have a windows client application (written in C#)
I have joined two SQL Queries using SQL UNION Operator Example: $query1 = SELECT
I have created some extra functionality on my Linq-to-SQL classes to make things easier

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.