GetAFreelancer.com
 
Find projectsSearch
Sign Up | Log in | Top Rated Users | Browse projects | Post Project | RSS feeds | Articles
 

Drag & Drop Photos / Update MySQL

  Trial project  Click here to post similar project

Drag & Drop Photos / Update MySQL is project number 270293 posted at GetAFreelancer.com. Click here to post your own project.

Closed
(Selected Service Provider devcenter)
Status: Closed
Budget: $30-250
Created: 06/04/2008 at 2:33 EDT
Bidding Ends: 06/11/2008 at 2:33 EDT
Project Creator: aguaweb View PM Post PM
Buyer Rating: 10.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/10
(2 reviews)
Description: 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
photo_id
model_id
photo_position

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.

********************************************************************************************************************
MY CODE:

<?php
// (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 . "'");
$i++;
}
?>

<html>
<body>
<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" />
</div>
<?php } while ($row_rs_photo = mysql_fetch_assoc($rs_photo)); ?>
</div>

<script type="text/javascript">
new Sortables($('photo_arrange'), {
onComplete: function() {
new Ajax("model_arrange.php?model_id=<?php echo $model_id; ?>&order="+this.serialize(function(el) {
return el.id.replace("photo_","");
})).request();
}
});
</script>

</body>
</html>


********************************************************************************************************************
JAVASCRIPT CODE:
Attached in file.

Additional files submitted:
mootools.js
Report violation
Job Type:
  • AJAX
  • Javascript
  • PHP
Database: MySQL
Operating system: Linux
Bid count: 3
Average bid: $ 32

 

Related project
 
CHIEF WEB DEVELOPER in Germany Featured
posted by olapa
Budget: N/A
 

FREE Trial project for new buyers!

 

View Project Message Board     Post Message on Project Message Board
Messages Posted: 0

If you are the project creator or one of the bidders Log in as project creator or bidder for more options

Bid on This Project

Service Providers PMB Bid Delivery Within Time of Bid Provider Rating
devcenter
View PM Post PM
$ 30 0 days 06-04-2008 03:14 10.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/1010.00/10
(2 reviews)
I can do it within hours. I've experienced this kind of task. Thanks.
samsolutions21
View PM Post PM
$ 35 0 days 06-05-2008 06:24 (No Feedback Yet)
I am ready to start
kunnal
View PM Post PM
$ 30 2 days 06-05-2008 12:51 (No Feedback Yet)
Sir I will do this for you.And u will appreciate my work thanks
Bid on This Project

 

[ Outsourcing Web Design ] [ Web Forms ] [ Web Development ]

What is GetAFreelancer.com? ( Read about the company )

Buy services with help from our secure escrow system. We have thousands of satisfied clients around the world. Deposit money and don't purchase until your project is completed. Our escrow feature is developed to protect both buyers and sellers.

Companies of any size have used our web services. Our mission is to find the best possible freelance workers at the best possible price. Would you like to outsource your next project? Would you like to make money as a freelancer? Click Sign Up to start!

Find Webmaster Resources and Webmaster Forum. Take a look at Search Engine Submission.