Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.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 通过不在postgresql中工作来订购_Php_Postgresql - Fatal编程技术网

Php 通过不在postgresql中工作来订购

Php 通过不在postgresql中工作来订购,php,postgresql,Php,Postgresql,这不起作用,我因为某种原因从param的订单中得到一个错误 if($selected_radio == 'city') { $query = "SELECT name FROM City WHERE name LIKE $1 LIMIT $2 OFFSET $3 ORDER BY name ASC"; $result = pg_prepare($conn, "findCity", $query); $result = pg_execute($conn, "findCity

这不起作用,我因为某种原因从param的订单中得到一个错误

if($selected_radio == 'city')
{
    $query = "SELECT name FROM City WHERE name LIKE $1 LIMIT $2 OFFSET $3 ORDER BY name ASC";
    $result = pg_prepare($conn, "findCity", $query);
    $result = pg_execute($conn, "findCity", array($text, $limit, $offset));

    while($row = pg_fetch_assoc($result))
    {
        echo "<tr>";
        echo "<td>" . $i . "</td>";
        echo "<td>" . $row['name'] . "</td>";
        echo "</tr>";
        $i += 1;
    }
}
if($selected\u radio==“city”)
{
$query=“从名称如$1 LIMIT$2 OFFSET$3 ORDER BY name ASC的城市选择名称”;
$result=pg_prepare($conn,“findCity”,$query);
$result=pg_execute($conn,“findCity”,数组($text,$limit,$offset));
while($row=pg_fetch_assoc($result))
{
回声“;
回音“$i”;
回显“$row['name']”;
回声“;
$i+=1;
}
}

很抱歉,我对这个网站相当陌生,不知道如何正确地发布代码:/

您的条款在-ORDER BY goes before LIMIT and OFFSET中

从文档中:

SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
     * | expression [ AS output_name ] [, ...]
     [ FROM from_item [, ...] ]
     [ WHERE condition ]
     [ GROUP BY expression [, ...] ]
     [ HAVING condition [, ...] ]
     [ { UNION | INTERSECT | EXCEPT } [ ALL ] select ]
     [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
     [ LIMIT { count | ALL } ]
     [ OFFSET start ]
     [ FOR { UPDATE | SHARE } [ OF table_name [, ...] ] [ NOWAIT ] [...] ]

你的条款在限制和抵消之前按顺序排列

从文档中:

SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
     * | expression [ AS output_name ] [, ...]
     [ FROM from_item [, ...] ]
     [ WHERE condition ]
     [ GROUP BY expression [, ...] ]
     [ HAVING condition [, ...] ]
     [ { UNION | INTERSECT | EXCEPT } [ ALL ] select ]
     [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
     [ LIMIT { count | ALL } ]
     [ OFFSET start ]
     [ FOR { UPDATE | SHARE } [ OF table_name [, ...] ] [ NOWAIT ] [...] ]

你能包含准确的错误消息吗?要格式化代码,请将其缩进4个空格,或者选择它,然后单击
{}
按钮。出于某种原因,我没有收到错误消息?@JoshValdivieso你应该这样做,所以你也需要对此进行调查。失败的语句报告错误消息非常重要,这样你就可以对它们采取行动。你能包含准确的错误消息吗?要格式化代码,请将其缩进4个空格,或者选择它,然后单击
{}
按钮。出于某种原因,我没有收到错误消息?@JoshValdivieso你应该这样做,所以你也需要对此进行调查。失败的语句报告错误消息非常重要,这样您就可以对它们采取行动。