不能让查询结果作为变量工作


Can't get query results to work as a variable

我使用以下代码来尝试显示'calls'字段中的数据,其中"people_id"字段等于1:

$query1 = mysql_query("SELECT calls FROM ae8vo_survey WHERE people_id = '1'");
$result = mysql_fetch_array($query1);
echo $result['calls'];

没有显示,即使查询工作正常。

试试这个

$calls = mysql_result(mysql_query("SELECT calls FROM ae8vo_survey WHERE people_id = '1'"), 0);
echo $calls;

我也遇到过这个问题,你必须按数字调用

所以尝试……

echo $result[0];