0

Hello Guys,
During the process of making my website I have been stopped by a problem.

Background Info: I am using jQuery sortable lists and I have multiple lists on the site which submit the information to the file that updates them in the database.

Problem: If I want to move one item to another list, I need to change one field in a MySQL table to correspond with the name of the UL.

This is my file that submits the information to the database:

<?php 
session_start();
include('config.php');


parse_str($_POST['containersTop'], $containersTopPos);

foreach ($containersTopPos['page'] as $moduleOrderTop => $moduleIdTop) {
    mysql_query("UPDATE modules SET `order` = '$moduleOrderTop' WHERE `id` = '$moduleIdTop' ") or die(mysql_error());
}

parse_str($_POST['containersMain'], $containersMainPos);

foreach ($containersMainPos['page'] as $moduleOrderMain => $moduleIdMain) {
    mysql_query("UPDATE modules SET `order` = '$moduleOrderMain' WHERE `id` = '$moduleIdMain' ") or die(mysql_error());
}
?>

Now, If I move an item from the list main to the list top, the section field in the MySQL table needs to be changed to top and vice versa.

What should I add for it to work like that?

Thanks,
Oskar

2
Contributors
1
Reply
25
Views
4 Years
Discussion Span
Last Post by LastMitch
0

Now, If I move an item from the list main to the list top, the section field in the MySQL table needs to be changed to top and vice versa.

Why move item? I assume you gotten the answer. Maybe a Join query resolve the issue?

I'm not sure what solution you got maybe a clarification on how you resolve the issue.

Just a simple explanation nothing more. I'm curious how you resolve it.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.