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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:13:57+00:00 2026-06-07T09:13:57+00:00

All, I’ve got the following PHP code: $qry = Select * from uploaded_files where

  • 0

All,
I’ve got the following PHP code:

$qry = "Select * from uploaded_files where user_id='$_SESSION[oml_user_id]' and upload_type='video_montage' order by sort ASC";
$result = mysql_query($qry);
$resultrows = mysql_num_rows($result);
if($resultrows>0){
?>
<ul class="gallery" id="video_gallery">
<?php
while($resultset = mysql_fetch_array($result)){
?>
<li id="<?php echo $resultset['file_id']; ?>"><a href="../upload/<?php echo $resultset['filename']; ?>"><img src="../upload/thumbnails/<?php echo $resultset['filename']; ?>" width="116" height="116" alt=""></a></li>
<?php
}
?>
</ul>
<button id="save_info">Save</button>

What I’d like to happen is when I click the save_info button I’d like to determine the current order of the li and the corresponding IDs of them that are associated with the ul. I’d like to then be able to just the .post function to submit them to a function to save these values to my database.

How can I determine the current order and IDs of the lis on my page?

Thanks in advance!

  • 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-07T09:14:00+00:00Added an answer on June 7, 2026 at 9:14 am

    Well $("#video_gallery li") will give you a jQuery object containing all the li elements in their current order. You can then loop through them with .each() and extract the ids:

    $("#save_info").click(function() {    
        var ids = [];
        $("#video_gallery li").each(function() {
            ids.push(this.id);
        });
    
        // do something with the ids, for example:
        $.post("test.php", { 'file_ids[]': ids });   
    });
    

    Demo: http://jsfiddle.net/5f4kr/

    (Alternatively you could use various other jQuery methods, e.g., $.map(), but the above is simple.)

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

Sidebar

Related Questions

All, If I run a query like the following: $qry = Select wrong_column from
All, I have the following code: $fetch = mysql_query(SELECT * FROM calendar_events where event_status='booked'
All, I've got the following jQuery code: jQuery.post(site_url + save_data.php, jQuery(this).serialize(), function(data) { //alert(Data
All, Say I have the following bit of code: select: function(start, end, allDay) {
All the code/commands below are part of a PHP script that processes images from
All, I have the following select box: <select class=event_selection name=Event[] id=Event_<?php echo $i; ?>
All, If I've go the following database fields/values: user_id field_name field_value 1 EventHour1 1
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
All, How can I bind the array of drop down list items returned from
All my code is here,quite simple,and I don't konw where it goes wrong. Person

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.