Listview 未按预期拆分
Listview is not being split as intended
我正在尝试创建一个带有拆分按钮的列表视图。拆分的按钮应该是一个删除图标,允许用户从列表中删除元素。
我读过的教程说,要在列表中添加拆分图标,您只需在列表项中添加第二个 link。下面的代码工作正常,直到它到达删除 link,它应该显示为删除图标。但是它不会,只是 returns 作为文本 hyperlink.
<?php
//include db configuration file
include_once("config.php");
echo '<ul data-role="listview" data-split-icon="delete">';
//MySQLi query
$results = $mysqli->query("SELECT customer_id,customer_name,barber_id FROM barber_queue ORDER BY customer_id");
//get all records from add_delete_record table
while($row = $results->fetch_assoc())
{
echo '<li><a href#her>';
$customer_id = $row["customer_id"];
echo 'Customer ID:';
echo $row["customer_id"];
echo 'customername:';
echo $row["customer_name"];
echo $row["barber_id"].'</li>';
echo '</a><a href="delete_customer.php?customer_id='.$customer_id.'" >Delete</a>';
echo '</li>';
}
echo '</ul>';
//close db connection
$mysqli->close();
?>
问题在于线路:
echo $row["barber_id"].'</li>';
您正在过早地关闭 <LI>
元素。
我正在尝试创建一个带有拆分按钮的列表视图。拆分的按钮应该是一个删除图标,允许用户从列表中删除元素。
我读过的教程说,要在列表中添加拆分图标,您只需在列表项中添加第二个 link。下面的代码工作正常,直到它到达删除 link,它应该显示为删除图标。但是它不会,只是 returns 作为文本 hyperlink.
<?php
//include db configuration file
include_once("config.php");
echo '<ul data-role="listview" data-split-icon="delete">';
//MySQLi query
$results = $mysqli->query("SELECT customer_id,customer_name,barber_id FROM barber_queue ORDER BY customer_id");
//get all records from add_delete_record table
while($row = $results->fetch_assoc())
{
echo '<li><a href#her>';
$customer_id = $row["customer_id"];
echo 'Customer ID:';
echo $row["customer_id"];
echo 'customername:';
echo $row["customer_name"];
echo $row["barber_id"].'</li>';
echo '</a><a href="delete_customer.php?customer_id='.$customer_id.'" >Delete</a>';
echo '</li>';
}
echo '</ul>';
//close db connection
$mysqli->close();
?>
问题在于线路:
echo $row["barber_id"].'</li>';
您正在过早地关闭 <LI>
元素。