【问题标题】:get value of mysql colum with numbers in name [duplicate]获取名称中带有数字的mysql列的值[重复]
【发布时间】:2020-04-23 05:50:41
【问题描述】:

我想获取我的 mysql 表的值。 列名有数字。

$temp= array();
$sql = "SELECT `00003A` FROM `table`";
$statement = $mysqli->prepare($sql);
$statement->execute();
$result = $statement->get_result();

while($row = $result->fetch_object()) {

    temp[] = $row->00003A;

}

我收到此错误:

Parse error: syntax error, unexpected '00003' (T_LNUMBER), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' on line 19

这是第 19 行:

temp[] = $row->00003A;

【问题讨论】:

    标签: php mysql


    【解决方案1】:

    您可以尝试将此值保存在变量中,例如:

    $prop = '00003A';
         temp[] = $row->$prop;
    

    或者用

    获取数据
    temp[] = $row['00003A'];
    

    【讨论】:

      猜你喜欢
      • 2017-09-20
      • 2019-12-23
      • 2012-02-08
      • 2015-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-09
      相关资源
      最近更新 更多