OK Celauran - after much research, testing, and playing, etc... I now have the ability to sort and drag and drop. I had to use some different ui files than we were using together and I've changed some of the functions you had. My script (as it stands now follows).
Code: Select all
<?php
session_start();
if(!isset($_SESSION['user_id'])){
header("Location: login.php");
}
// include database connection file, if connection doesn't work the include file will throw an error message
include '../schedule/include/db_connect.php';
$date1 = "10/01/2012";
echo $date1;
// strtotime() will convert nearly any date format into a timestamp which can be used to build a date with the date() function.
$timestamp = strtotime($date1);
$start_date = date("Y-m-d", $timestamp);
$result="SELECT DATE_FORMAT(List_Dates.DB_Date, '%m/%d/%Y') as newdate, DATE_FORMAT(List_Time.TFM_Time,'%h:%i %p') as newtime
FROM List_Dates, List_Time
WHERE DATE(DATE_FORMAT(List_Dates.DB_Date,'%Y-%m-%d')) LIKE '" . $start_date . "%'
ORDER BY List_Time.TFM_Time";
$answer = mysql_query($result);
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Celauran</title>
<!----Following files have all been tested and are all needed --->
<script type="text/javascript" src="/jquery-basic/js/jquery-1.7.1.min.js"></script>
<script src="/jquery/dev/ui/jquery.ui.core.js"></script>
<script src="/jquery/dev/ui/jquery.ui.widget.js"></script>
<script src="/jquery/dev/ui/jquery.ui.mouse.js"></script>
<script src="/jquery/dev/ui/jquery.ui.sortable.js"></script>
<!---- END File call ----->
<style>
#startList, #endList { list-style-type: none; margin: 0; padding: 0 0 2.5em; float: left; margin-right: 10px; }
#startList li, #endList li { margin: 0 5px 5px 5px; padding: 2px; font-size: 1.2em; width: 120px; }
</style>
<script type="text/javascript">
$(document).ready(function() {
$(function() {
$( "#startList, #endList" ).sortable({
connectWith: ".connectedSortable"
}).disableSelection();
});
$('#test').click(function() {
var my_arr=[];
$('ul#endList li').each(function(){
var btime = $(this).find('span:first-child').text();
my_arr.push(btime);
document.write (my_arr);
});
});
});
</script>
</head>
<body>
<ul id="startList" class="connectedSortable">
<?php
while($row = mysql_fetch_array($answer))
{
echo "<li>". $row['newtime'] ."</li>";
}
?>
</ul>
<ul id="endList" class="connectedSortable">
<li></li>
</ul>
<button id="test">Test</button>
</body>
</html>
Under your test button is the following script:
[syntax=php$('#test').click(function() {
var my_arr=[];
$('ul#endList li').each(function(){
var btime = $(this).find('span:first-child').text();
my_arr.push(btime);
document.write (my_arr);
});
});[/syntax]
If the above function was working properly it would output the following array:
08:00 AM,
08:00 AM,08:15 AM,
08:00 AM,08:15 AM,08:30 AM,
08:00 AM,08:15 AM,08:30 AM,08:45 AM,
Instead it is outputting:
,
,,
,,,
,,,,
The array is putting in the coma, but no value. So.... I'm assuming the array is either picking up a null value, or generating a null value.
Any ideas you have are welcome.
Pavilion