doumengxue7371 2015-03-13 12:23
浏览 7
已采纳

在我的WordPress网站上没有获取值?

Values are not fetching in my WordPress website? This is the code, tell me the write way to fetch value from data base......Values are not fetching in my WordPress website? This is the code, tell me the write way to fetch value from data base......

<?php 
        $sql2= "SELECT seat_per_day from `wps_reservation_setting` " ;
        $Data1 = mysql_query($sql2);

        $row2 = mysql_fetch_array($Data1);

        for($i = 1 ;$i <= $row2['seat_per_day'] ;$i++ )
        { 
        ?>
        <option value="<?php print $i; ?>"><?php print $i; ?></option>

        <?php } ?>
  • 写回答

1条回答 默认 最新

  • dousi1961 2015-03-13 12:55
    关注

    In wordpress fetch data from database as following

      global $wpdb;
      $table_set = $wpdb->prefix . 'reservation_setting';
        $fivesdrafts = $wpdb->get_results( 
            "
            SELECT seat_per_day 
            FROM $table_set
            "
        );
    
        foreach ( $fivesdrafts as $fivesdraft ) 
        {
            echo $fivesdraft->seat_per_day;
        } 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请提供一个符合要求的网页链接。
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码