【发布时间】:2014-09-21 03:30:58
【问题描述】:
我已经写了这段代码:
$statement = $db->prepare("SELECT answer FROM question WHERE question = :question");
$statement->execute(array(':question' => $question));
$row = $statement->fetch();
$answer = $row['answer']; // this gives me a number
现在我想从列中检索该行的值(给定的数字)+1
我应该怎么做才能得到它?
【问题讨论】:
-
$row = $statement->fetch(PDO::FETCH_ASSOC) -
依赖列的顺序似乎是一种危险的编码方式。列的名称是否像
answer1、answer2等? -
不安静,他们都有不同的名字