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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:40:18+00:00 2026-06-08T05:40:18+00:00

I am trying to edit a data query using php by passing it through

  • 0

I am trying to edit a data query using php by passing it through javascript,

my ajax request looks like

var totalSearchResult=10;
$.ajax({
    url:"php/queryManipulation.php",
    type: 'POST',
    data: { totalQuery : totalSearchResult,  query : '{"data":{"match_all":{}}}'},

    success: function(finalList)
    {
        alert(finalList);
    }
});

my php code looks like

<?php
$from=$_POST["totalQuery"];
$qry=json_decode($_POST["query"]);
$qry->from=$from;   }?>

I am trying to get it in the form,

{"data": {"match_all": {}} , "from": 10}

I get the error Object of class stdClass could not be converted to string

  • 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-08T05:40:20+00:00Added an answer on June 8, 2026 at 5:40 am

    Edit: Changed json_decode return value from array to object

    You need to encode the json again just after finishing the edits.
    So what you can do is something like:

    <?php
        $from            = $_POST["totalQuery"];
        $qry             = json_decode($_POST["query"]);
        $qry->data->from = $from;
        //you will get the new json string 
        //as the finalList variable in your post callback
        echo json_encode($qry); 
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: What I mean is displaying the XML data through HTML, not trying to
Using classic asp, I am trying to query a SQL Server database like so:
When trying Edit Table Data in MySQL Workbench 5.2.37, its in read only mode.
I am trying to edit grid data and save it to the grid itself
See updated input and output data at Edit-1. What I am trying to accomplish
I'm trying to edit a form with a ImageField and I´m using modelformset_factory in
I'm trying to create a csv export of data from mysql using the following
I'm trying to index data from a database in Solr using the DIH. So
I'm trying to run a query from ADO.NET using SQL Server 2008R2. I'm using
I am trying to query a MySQL database using webpy. From the SQL query,

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.