You are on page 1of 2

04/01/2021 Sorting MySQL Row Order using jQuery - Phppot

helping build websites Shop Services Testimonials Blog About Con

eCommerce Sorting MySQL Row Order using jQuery Hi, I’m Vincy. I help build websites
Components Last modified on April 6th, 2017. and I’m available for freelance work.
Files
In this tutorial we are going to learn how to change the MySQL row order. We vincy@phppot.com
UI are using jQuery to display sortable list of MySQL rows.
Performance Contact Form - Iris
We are using jQuery sortable() function to change the row order by drag and
Framework drop the rows. After changing we should save the new order in database.
PHP

Learn PHP
view demo
PHP Introduction
PHP Basics
Contact Form
Comments System
Types, Variables &
Operators
PHP Strings
PHP Arrays
PHP Functions
PHP OOPS
“From the beginning of the revision Vincy
PHP Forms
hands-on, providing constructive critiques
Advanced how to best make our system more efficie
PHP AJAX and streamlined. After her full analysis of
Country-State-City code structure ...” read more
Example: Cascading
jQuery AJAX Steve Kalinowski, CatechismClass.com,
Dependent Dropdown
in PHP MySQL Sortable Rows
Load Dependent
Dropdown on Multi- In this code we are getting MySQL rows and displaying to the browser using
Select using PHP and
jQuery sortable list items.
AJAX Based Login
Registration System <?php
with jQuery Lightbox $mysqli = new mysqli('localhost','root','','blog_examples');
$result = $mysqli->query("SELECT * FROM php_interview_questions ORDER BY
Create AJAX-Based ?>
PHP Event <form name="frmQA" method="POST" />
Management System <input type = "hidden" name="row_order" id="row_order" />
with Bootstrap <ul id="sortable-row">
How to Create <?php
Facebook Like Infinite while($row = $result->fetch_assoc()) {
Scroll Pagination using ?>
PHP and jQuery <li id=<?php echo $row["id"]; ?>><?php echo $row["question"]; ?><
<?php
Facebook Like Header }
Notification in PHP $result->free();
$mysqli->close();
Sorting MySQL Row
?>
Order using jQuery
</ul>
AJAX Pagination with <input type="submit" class="btnSave" name="submit" value="Save Order
PHP </form>
Change Order of
Images in Photo
Gallery with Drag and
Drop using PHP AJAX
jQuery Sortable and Save Order Function
PHP AJAX
Programming
This script contains jQuery functions to make MySQL rows sortable. And also
PHP Star Rating
System with JavaScript contains function to save new order to the database. This function will implode
Events Display using changed row order and add them to a hidden field.
PHP AJAX with CLNDR
Calendar Plugin
<script>
RESTful API $(function() {
$( "#sortable-row" ).sortable();
PHP Databases });
PHP Sessions and
Cookies function saveOrder() {
var selectedLanguage = new Array();
Error and Exception $('ul#sortable-row li').each(function() {
Handling selectedLanguage.push($(this).attr("id"));
File Upload });
document.getElementById("row_order").value = selectedLanguage;
Files and Directories }
PHP Date Time </script>

PHP XML
PHP Code Samples
PHP MySQL Row Order Update
Library
More PHP

https://phppot.com/php/sorting-mysql-row-order-using-jquery/ 1/2
04/01/2021 Sorting MySQL Row Order using jQuery - Phppot
PHP Freelancer This PHP script read form data for getting the new row order. It executes MySQL
update query to save new order in database.

if(isset($_POST["submit"])) {
$id_ary = explode(",",$_POST["row_order"]);
for($i=0;$i<count($id_ary);$i++) {
$mysqli->query("UPDATE php_interview_questions SET row_order='" . $i
}
}

view demo download

Popular Articles
★ PHP AJAX Programming
★ Create AJAX-Based PHP Event Management System with Bootstrap
★ PHP Star Rating System with JavaScript

Search articles

↑ Back to Top

Looking for a freelance web developer?


Do you want to build a modern, lightweight, responsive website and launch quickly? Contact Me

Blog subscription:

Enter your email here Subscribe

Shop

FAQ Support Policy Refund Policy Licenses


Terms of Service Privacy Policy Cookie Policy © 2020 Phppot

https://phppot.com/php/sorting-mysql-row-order-using-jquery/ 2/2

You might also like