PHP:HTML表中的SQL数据未排序
我试图用两种方式整理我的数据。单击链接时,表不会更新 HTML:PHP:HTML表中的SQL数据未排序,php,html,sql,Php,Html,Sql,我试图用两种方式整理我的数据。单击链接时,表不会更新 HTML: echo "<tr>"; echo "<table id='customers'> <thead> <tr> <th><a href='?orderBy=producto'> Producto</a></th> <th>Unidad</th>
echo "<tr>";
echo "<table id='customers'>
<thead>
<tr>
<th><a href='?orderBy=producto'> Producto</a></th>
<th>Unidad</th>
<th>Candidad Necesaria</th>
<th>Precio Objetivo por Unidad</th>
<th><a href='?orderBy=ctot_obj'>Valor Producto<a/></th>
<th>Remover Entrada</th>
</tr>
</thead>
我做错了什么?您有一个打字错误:
$query_ord = $mysqli->query("SELECT * FROM busca ORDER BY '" . $order . "'");
从sql查询中删除
,然后重试
$query_ord = $mysqli->query("SELECT * FROM busca ORDER BY '{$order}'");
echo
”
html代码”
在html代码中,使用“
而不是”
在href或/
echo '<tr><table id="customers">
<thead>
<tr>
<th><a href="./?orderBy=producto"> Producto</a></th>
<th>Unidad</th>
<th>Candidad Necesaria</th>
<th>Precio Objetivo por Unidad</th>
<th><a href="?orderBy=ctot_obj">Valor Producto<a/></th>
<th>Remover Entrada</th>
</thead>
echo'
尤尼达
Necesaria假丝酵母
目标明确
产品勇气
夹杂去除剂
要实现此目的,请在代码中进行一些更改。假设您的页面名称为details.php
,请进行以下更改:
<a href='details.php?orderBy=producto'>
不起作用。如果我回显查询似乎是合法的,但表显然没有得到重新组织。直接对MySQL运行查询输出——您得到正确的输出吗?如果是,那么您可以编辑您的问题并添加一个代码段,在其中迭代
$query\u ord
并回显行/列吗?问题可能就在那里。我已经解决了。我已经解决了早期的查询创建了一个无休止的循环。谢谢!
<a href='details.php?orderBy=producto'>
$orderBy = $_GET['orderBy'];