Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP:HTML表中的SQL数据未排序_Php_Html_Sql - Fatal编程技术网

PHP:HTML表中的SQL数据未排序

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>

我试图用两种方式整理我的数据。单击链接时,表不会更新

HTML:

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'];