[英]Drag & Drop with PHP & jQuery
I have used the following code found here on a page I am developing and all is working fine. 我已经使用发现下面的代码在这里 ,我发展和所有工作正常,在页面上。
I would however, like to be able to pull mulitple columns from my database and have them formatted on a table. 但是,我希望能够从数据库中提取多个列并将其格式化为表格。
I have tried everything and cannot get this to work. 我已经尝试了一切,但无法使它正常工作。 Should I be using HTML tables or something else? 我应该使用HTML表还是其他? The code below just displays all columns as one long unformatted row. 下面的代码仅将所有列显示为一个长而无格式的行。
<div id="container">
<div id="list">
<ul>
<?php
include("connect.php");
$query = "SELECT id, listorder, description, owner, perc_complete, start_date, end_date FROM acct_project_details WHERE project_id='1' ORDER BY listorder ASC";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$id = stripslashes($row['id']);
$listorder = stripslashes($row['listorder']);
$text = stripslashes($row['description']);
$owner = stripslashes($row['owner']);
$perc_complete = stripslashes($row['perc_complete']);
$start_date = stripslashes($row['start_date']);
$end_date = stripslashes($row['end_date']);
?>
<li id="arrayorder_<?php echo $id ?>">
<?php echo $text; ?>
<?php echo $owner; ?>
<?php echo $perc_complete; ?>
<?php echo $start_date; ?>
<?php echo $end_date; ?>
<div class="clear"></div>
</li>
<?php } ?>
</ul>
</div>
</div>
Many thanks in advance, 提前谢谢了,
John 约翰
Use table tr td
and TableDnD plugin : 使用table tr td
和TableDnD插件:
<!-- DOWNLOAD THESE SCRIPTS -->
<script type='text/javascript' src='http://isocra.com/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>
<script type='text/javascript' src='http://isocra.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript' src='https://github.com/isocra/TableDnD/blob/master/stable/jquery.tablednd.js'></script>
<script type="text/javascript">
$(document).ready(function() {
$("table.dnd").tableDnD();
});
</script>
<div id="container">
<div id="list">
<table class="dnd">
<?php
include("connect.php");
$query = "SELECT id, listorder, description, owner, perc_complete, start_date, end_date FROM acct_project_details WHERE project_id='1' ORDER BY listorder ASC";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$id = stripslashes($row['id']);
$listorder = stripslashes($row['listorder']);
$text = stripslashes($row['description']);
$owner = stripslashes($row['owner']);
$perc_complete = stripslashes($row['perc_complete']);
$start_date = stripslashes($row['start_date']);
$end_date = stripslashes($row['end_date']);
?>
<tr id="arrayorder_<?php echo $id ?>">
<td><?php echo $text; ?></td>
<td><?php echo $owner; ?></td>
<td><?php echo $perc_complete; ?></td>
<td><?php echo $start_date; ?></td>
<td><?php echo $end_date; ?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.