【问题标题】:How to display stored array from database [closed]如何显示数据库中存储的数组[关闭]
【发布时间】:2013-07-14 12:14:03
【问题描述】:

这就是我将数组存储到数据库中的方式(更大代码的一部分):

 echo '<form action="" method="post">';

        for ($count = 0; $count < $_GET["entries"]; $count++)
        {
            echo  'Enter a beginning to ending date for the week: <input type="text" name="week"><br/>';
        }

        echo '<input type="submit" name="submit"></form>';

它在一个标签内,因此是回声。

我检查了我的数据库,我可以看到第一个日期,所以它正在被存储。

这就是我显示数组的方式(似乎不起作用):

我哪里出错了?它只是输出还是输入?对于可能的答案,我真的很感激任何建议。谢谢。

Current Specific Weeks: <?php 

    foreach ($currentWeeks as $currentWeeks)
    {
        echo "{$currentWeeks}\n";
    }

【问题讨论】:

    标签: php sql arrays forms foreach


    【解决方案1】:

    Foreach 错误。您对数组和元素都使用了$currentWeeks

    【讨论】:

      【解决方案2】:

      foreach循环中使用不同的变量名

      foreach ($currentWeeks as $week)
                                ^^^^^ // here
      {
          echo "{$week}\n";
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-08-14
        • 2012-08-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多