【问题标题】:How do I echo out to variables?如何回显变量?
【发布时间】:2018-08-30 01:35:43
【问题描述】:

我正在尝试发布用户的firstnamelastname。我所做的是:

<td><?php echo $row_message['firstname']['lastname']; ?></td>

我收到了Warning: Illegal string offset

有人可以教我怎么做吗?我读过有关它的资料,但我似乎无法理解。

这是我的数据库架构:

DB Schema

【问题讨论】:

  • echo $row_message['firstname']; echo $row_message['lastname'];
  • @AniketSahrawat 非常感谢,您可以将其发布为您的答案。我如何在中间放置空间?
  • 1) echo $row_message['firstname'] . " " . $row_message['lastname']; 2) echo $row_message['firstname']; echo " "; echo $row_message['lastname'];
  • echo $row_message['firstname']." ".$row_message['lastname'];
  • 您也可以使用var_dump($row_message);print_r($row_message);打印所有内容。

标签: php html mysql database phpmyadmin


【解决方案1】:

您应该像这样单独检索它们

<td><?php echo $row_message['firstname'].' '.$row_message['lastname']; ?></td>

【讨论】:

    猜你喜欢
    • 2014-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多