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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:31:40+00:00 2026-06-12T03:31:40+00:00

I have a decent grasp on Python which I thought would help me here

  • 0

I have a decent grasp on Python which I thought would help me here but I guess I dont have the programmers mind set yet 🙂

I am tweaking an existing PHP script that does a check on a MSSQL Server. Our script runs a query and compares the result with an expected result. Here is part of the script:

    if ($query_result == $expected_result) {

I need to modify this so that if the query_result is within +1 or -1 of the expected_result, to return true. Maybe soemthing like this?:

    if ($query_result <=> $expected_result -+ 1) {

I can’t figure out how to properly write this 😛 All help is greatly appreciated!

Thanks

  • 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-12T03:31:41+00:00Added an answer on June 12, 2026 at 3:31 am
    if (abs($query_result - $expected_result) <= 1) {
       ... they're within "1" of each other
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't have any experience writing drivers, but have a decent grasp on architecture,
I am new to PHP, but have a decent grasp of things (have not
I am pretty new to Haskell but I feel like I have a decent
I have tried to find some decent documentation on traversing in jQuery, but have
I have a decent idea in mind. I don't see a lot of stuff
We have a decent set of unit tests on our code and those unit
I have a decent working web application (Java/Servlet/Jsp) that I would like to improve
I have an account with Interactive Brokers. They have a decent trading API, but
I'm not an advanced user of CSS, but I have a decent working knowledge
I'm fairly new to Dreamweaver and am testing the trial software. I have decent

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.