Drag & Drop Photos / Update MySQL

I am creating an interface for a client where they can drag and drop images to arrange the photo order. The new order must then update a MySQL database using PHP.

Database Fields: - Primary key is combination of photo_id and model_id




After the photos are reordered, it needs to update the photo_position field for the specified photo_id/model_id combination.

Here's the code I'm using... the drag and drop is working, but the database is not being updated. I'm told the javascript should refresh the page automatically and run the PHP script but I'm not very experienced with AJAX.




// (db connect & call recordset)

$model_id = $_GET['model_id'];

foreach(explode(",",$_GET['order']) as $key=>$value) {

mysql_query("UPDATE tbl_model_photo SET photo_position='" . $i . "' WHERE model_id = $model_id and photo_id = '" . $value . "'");






<div id="photo_arrange">

<?php do { ?>

<div id="photo_<?php echo $photo_id; ?>">

<img src="../images/models/photos/<?php echo $model_id; ?>/<?php echo $photo_id; ?>.jpg" />


<?php } while ($row_rs_photo = mysql_fetch_assoc($rs_photo)); ?>


<script type="text/javascript">

new Sortables($('photo_arrange'), {

onComplete: function() {

new Ajax("[url removed, login to view];?php echo $model_id; ?>&order="+[url removed, login to view](function(el) {

return [url removed, login to view]("photo_","");









Attached in file.

Evner: AJAX, Javascript, PHP

Se mere: drag drop mysql, drag drop update mysql, drag drop images mysql, php mysql drag drop, drag update mysql, mootools drag drop mysql, drag drop images save mysql, ajax mysql drag drop, javascript drag drop mysql, drag drop mysql javascript, drag drop update mysql php, php drag drop connect mysql, drag photo update mysql, javascript drag drop div save mysql, combination php ajax drag drop, ajax drag drop mysql, photo drag drop code php, javascript drag drop photo, javascript drag drop div order, javascript drag drop arrange, drag drop save mysql, drag drop javascript mysql, drag drop div mysql, drag drop php mysql, save drag drop images database using php

Om arbejdsgiveren:
( 4 bedømmelser ) Carlsbad, United States

Projekt ID: #270293

Tildelt til:


I can do it within hours. I've experienced this kind of task. Thanks.

$30 USD in 0 dage
(2 bedømmelser)

3 freelancere byder i gennemsnit $32 på dette job


I am ready to start

$35 USD in 0 dage
(0 bedømmelser)

Sir I will do this for [login to view URL] u will appreciate my work thanks

$30 USD in 2 dage
(0 bedømmelser)