gpt4 book ai didi

php - 使用 PHP 和 jQuery 进行拖放

转载 作者:行者123 更新时间:2023-11-30 00:35:21 26 4
gpt4 key购买 nike

我使用了以下代码发现here在我正在开发的页面上,一切正常。

但是,我希望能够从数据库中提取多个列并将它们格式化在表格上。

我已经尝试了所有方法,但无法使其正常工作。我应该使用 HTML 表格还是其他东西?下面的代码仅将所有列显示为一长未格式化的行。

<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>

提前非常感谢,

约翰

最佳答案

使用table tr tdTableDnD插件:

<!-- 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>

关于php - 使用 PHP 和 jQuery 进行拖放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22226499/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com