我已经浏览了整个网络,似乎无法找到将MySQL查询的结果分配给PHP变量的正确方法。我目前拥有的代码返回“资源ID#3”错误。这是它的样子。
//Select the 'aQID' of the question that has it's BOOL set to "true"
$currentQ = mysql_query("SELECT aQID FROM approvedQuestions WHERE status='1'");
$cuQ = mysql_result($currentQ,1,"status");
echo $cuQ;
我知道查询只返回一条记录(活动问题)。但我似乎无法弄清楚使用什么功能。
答案 0 :(得分:0)
$currentQ = mysql_query("SELECT aQID FROM approvedQuestions WHERE status='1'");
$rs = mysql_fetch_array($currentQ);
var_dump($rs);