简单的问题,当我运行一个涉及'ints'的SELECT查询时,它们被转换为文本/字符串。
//run a query to find the fields of the hall, using the id in the url ($current_id)
if ($findreview = $db->prepare("SELECT * FROM reviews_temp")) {
//Execute the prepared query
$findreview->execute();
//search hall table for all fields and save them in $hall
$reviewtemp = $findreview->fetchAll();
foreach( $reviewtemp as $review) {
$name = $review['name'];
$email = $review['email'];
$overall = $review['overall'];
}}
数据库中的“整体”字段是“int”类型。原因是该领域的数据需要用于计算。
当我回显$overall
变量时,它会打印字母't',而不是数据库字段中的数字。
我将如何解决这个问题?
EDIT 表如下,有3个字段:
(id,datatype,data)
name - varchar - Joe
电子邮件 - varchar - example@example.com
整体 - tinyint - 6