php - mysql_fetch_assoc 中的 is_numeric()

标签 php mysql syntax

您好,我正在尝试检查值 mysql_fetch_assoc($query)一个数字。但出现错误:

Parse error: syntax error, unexpected T_STRING, expecting '(' in /var/www/xmlexport/run/test.php on line 53

我正在使用:

while($values_query = mysql_fetch_assoc($query))

第 53 行是:

    if is_numeric($values_query['row5']) { $testt = round(($values_query['row5']), 2); } else { $testt = 'hello'; }

最佳答案

试试这个:

 if (is_numeric($values_query['row5'])) { $testt = round(($values_query['row5']), 2); } else { $testt = 'hello'; }

if条件没有括号

关于php - mysql_fetch_assoc 中的 is_numeric(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37808574/

相关文章:

php - 使用 laravel Controller 从 $.ajax 调用接收数据

Javascript 对象偏执狂(我可以依赖元素的顺序吗)

mysql - 导入mysql数据库出错

c++ - C++ 中短格式 "if"的 Python 等效项

sql - 不运行查询的 PostgreSQL 语法检查

javascript - 日期选择器在 Internet Explorer 中不起作用

PHP Mysql 按日期排序

javascript - jquery多术语列搜索

mysql - 查询计数(id)或按 id 排序哪个更便宜

sql - 用于从特定行生成列的大查询语法