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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:07:19+00:00 2026-05-15T17:07:19+00:00

how to make the response result at sEcho become not zero? {sEcho: 0, i’ve

  • 0

how to make the response result at sEcho become not zero?

{"sEcho": 0, 

i’ve been use this code but result still zero..

 $sOutput .= '"sEcho": '.intval($_POST['sEcho']).', ';
  • 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-15T17:07:20+00:00Added an answer on May 15, 2026 at 5:07 pm

    Okay, time to elevate this to an answer.

     $sOutput .= '"sEcho": '.intval(postVar('sEcho')).', ';
    

    This line takes the output of the function postVar, when given the paramater 'sEcho', then takes that result and runs it through the built-in function intval.

    That integer is then appended using the . concatenation operator to the string '"sEcho":', which is then appended to the variable $sOutput

    intval turns whatever it was passed into an integer. This is like casting. Pretty much any string is turned into zero. intval('YOUR FACE IS ON FIRE') will return 0, intval('') will return 0, etc.

    I don’t know where postVar is, but I’m going to wager based on the provided example code link that it’s some ill-conceived wrapper around $_POST. So, another way to write it might be:

    $sEcho = (int)$_POST['sEcho'];
    $sOutput .= '"sEcho": ' . $sEcho . ', ';
    

    The bottom line is that the thing being passed to intval is turned into zero. It’s very likely that the input named “sEcho” is not a string that can be turned into anything but zero.

    That’s where your zero is coming from.

    To fix it, you need to pass something to intval that won’t get turned into a zero.


    As a side-note, if you’re actually using the linked example code, you should probably be aware that the code in question is complete, utter garbage. It’s filled with bad practices, like persistent connections, the use of the outdated mysql extension, manual assembly of JSON strings, and the most horror of horrors, a poorly thought out Hungarian Notation style. Seriously, sEcho being a thing that was cast to an integer? Shouldn’t it be iEcho then? Sigh.

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

Sidebar

Related Questions

In my code I'd like to make my repositories IQueryable. This way, the criteria
I have this piece of code to make an asynchronous HTTP request: public static
I asked a related but very general question earlier (see especially this response ).
I have made this so far. It's code that will make a json String
Please if you know, make a response. thanks
How can I make my view resize in response to the in-call status bar
How to make a multi-thread python program response to Ctrl+C key event? Edit: The
I make an async request in a web where the response is parsed into
Edit Make sure you don't juxtapose the request and response objects. things will be
I'm trying to make an ajax request recursively upon each success response that is

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.