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

  • Home
  • SEARCH
  • 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 931853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:34:15+00:00 2026-05-15T20:34:15+00:00

I’m sorting a list and using Ajax to update a database. I need help

  • 0

I’m sorting a list and using Ajax to update a database. I need help parsing the string. This is the query string that I need to parse:

images_list[]=32&images_list[]=95&images_list[]=97&images_list[]=96&images_list[]=102&images_list[]=103&images_list[]=99&images_list[]=101&images_list[]=98&john=hi

I have put john=hi to test to see if the string is actually being sent via Ajax to the processor.php file. I am able to get the variable john=hi from the URL, so the query string is being sent perfectly fine. This is my code so far, but I can’t seem to access the data I need, it appears as if nothing is there:

<?php
    // Connect to the database
    require_once('connect.php');

    parse_str($_GET['images_list']);
    for ($i = 0; $i < count($images_list); $i++) {
        $id = $images_list[$i];
        mysql_query("UPDATE images SET ranking = '$i' WHERE id = '$id'");
        echo $images_list[$i];
    }
?>
  • 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-15T20:34:15+00:00Added an answer on May 15, 2026 at 8:34 pm

    $_GET['images_list'] is an array of integers. There’s nothing to parse there. PHP already did it for use. So, skip the parse_str part and easily use $_GET['images_list'] instead of $images_list.

    Whole code:

    <?php
        //Connect to DB
        require_once('connect.php');
    
        foreach ($_GET['images_list'] as $i => $id) {
            mysql_query("UPDATE images SET ranking = " .
                        mysql_real_escape_string($i) .
                        " WHERE id = " .
                        mysql_real_escape_string($id));
            echo $id;
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 503k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer With ReSharper you can navigate to "Containing Declaration" (default key… May 16, 2026 at 2:45 pm
  • Editorial Team
    Editorial Team added an answer http://guides.rubyonrails.org/v2.3.8/ http://api.rubyonrails.org/v2.3.8/ ok? :) May 16, 2026 at 2:45 pm
  • Editorial Team
    Editorial Team added an answer Under Scala 2.8, I get scala> a.map(x => (x._1,x._2 +… May 16, 2026 at 2:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I need help sorting [Time] data from in this array in php. For a
I'm trying to implement a paging and sorting list in ASP.NET MVC without using
I am looking for advice about how to parse a single list, using two
Hey guys I have one more question lol. I am using a script that
I have sorted collection (List) and I need to keep it sorted at all
I have a Groovy application. I am rendering the view list using the following
I am using xslt and I want to implement sorting on my href link.
I have a list of names that I'd like to have bound to a
I found this in the wikipedia article on utf-8: Sorting of UTF-8 strings as
I have some view (Views 2 - list of invitations, table style) which uses

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.