如何解决非法字符串偏移错误?

时间:2018-12-29 06:16:16

标签: php html postgresql

我正在尝试从postgres数据库中获取一些数据,并使用php将其显示在文本框中。但是,每当我尝试在文本框中回显数据时,我都会遇到非法的字符串偏移错误。

我以前在相同的代码上编写了一个查询,并使用pg_query()执行了该查询,但是当我在当前查询中使用它时,它会阻塞两个sql查询。

<?php
$sql = "select order_number, order_date from orders where 
customer_account_code = '1028486' and conference_code= 'DS19-'";
$result1= pg_query($db, $sql);
?>
<input class ="form-control" value="<?php echo $result1['order_number']; ? 
 >">
?>

这是它给出的错误

警告:字符串偏移量“ order_number”非法

0 个答案:

没有答案