0

I have this query here:

$query_pag_num = "SELECT id(*) AS count FROM forma";
$result_pag_num = odbc_exec($connection, $$query_pag_num) or die(odbc_error());

I get this error though:

Undefined variable: SELECT id(*) AS count FROM forma in

Could someone please help me with this? Thanks..

I get an error about the id here:

$row = odbc_fetch_array($result_pag_num);
$count = $row['id'];
4

1 回答 1

1

那是无效的语法。 id(*)不是定义的东西,这就是错误的原因。正确的方法是

$query_pag_num = "SELECT count(id) AS myCount FROM forma";

为什么你$$这里有两个?这使它成为一个可变变量

$result_pag_num = odbc_exec($connection, $$query_pag_num) or die(odbc_error());
                                          ^

它一定要是

$result_pag_num = odbc_exec($connection, $query_pag_num) or die(odbc_error());

于 2013-07-25T07:13:58.830 回答