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

Member Avatar for LastMitch

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.