SELECT MAX(...在PHP/MYSQL中不返回任何内容

问题描述:

这是表结构-

Table: test

+------+---------+
| PAGE | CONTENT |
+------+---------+
|  1   |   ABC   |
+------+---------+
|  2   |   DEF   |
+------+---------+
|  3   |   GHI   |
+------+---------+

PAGE是数据类型为INT(11)的主数据库.它不会自动增加. CONTENT的数据类型为TEXT.

PAGE is a Primary with datatype INT(11). It does not auto-increment. CONTENT is of the datatype TEXT.

在PHP中,我这样做-

In PHP I do-

$result = mysql_query(SELECT MAX(PAGE) FROM test);
$row = mysql_fetch_array($result);
echo $row["PAGE"];

无输出.完全没有.如果我做类似echo "Value : ".$row["PAGE"];的事情,我所看到的就是Value :

No output. At all. If I do something like echo "Value : ".$row["PAGE"]; all I see is Value :

查询SELECT * FROM test正常工作.我在使用MAX()语法的地方错了吗?

The query SELECT * FROM test works just fine though. Am I wrong somewhere using the MAX() syntax?

我希望它返回到目前为止的PAGE最大值.

I want it to return the maximum value of PAGE as of yet.

这应该是代码.

$result = mysql_query("SELECT MAX(PAGE) AS max_page FROM test");
$row = mysql_fetch_array($result);
echo $row["max_page"];