i am looking to show on calendar the unavailable dates of hotel rooms , that are alredy booked, but i am only able to show one date, but i want to show all dates booked on that month liked, one from 20-25, second 29-31...

我希望在日历上显示酒店房间的不可用日期,这是预订的alredy,但我只能显示一个日期,但我想显示该月份预订的所有日期,一个从20-25,第二个29 -31 ...

echo $query = "SELECT * FROM booking_request where room_id = 1' '<br>' ";
$result = $db->query($query);
        if( $result -> num_rows > 0 ) {
            while( $row = $result-> fetch_assoc() )
            {
            echo $name = $row['getaway_name']." <br>";
            echo $start = $row['check_in_date']." <br>";
            echo $end = $row['check_out_date']." <br>";
            $cp = array();
            $arr1 = range(strtotime($row['check_in_date']),strtotime($row['check_out_date']), "86400");

            array_walk_recursive($arr1, function(&$element) { $element = date("d-n-Y", $element); });
           print_r ($arr1); 
            } 

i am getting all the dates in

我得到了所有日期

Array ( 
[0] => 15-5-2016 
[1] => 16-5-2016 
[2] => 17-5-2016 
[3] => 18-5-2016 
[4] => 19-5-2016 
[5] => 20-5-2016 
) 

Array ( 
[0] => 29-5-2016 
[1] => 30-5-2016 
[2] => 31-5-2016 
) 

like this from while loop, i want this in single array ..

喜欢这个来自while循环,我希望在单个数组中..

3 个解决方案

#1


0

Arrays always have keys, whether you want them or not. Even a simple array('15-5-2016', '16-5-2016'); will be array([0] => '15-5-2016', [1] => '16-5-2016');. That being said, your array does start with 0, and not with 1.

数组总是有键,无论你是否想要它们。即使是一个简单的数组('15 -5-2016','16 -5-2016');将是数组([0] => '15 -5-2016',[1] => '16 -5-2016');.话虽这么说,你的数组确实从0开始,而不是1。

If you want only values then you have to use loop(foreach, I recommend) where you want to use this array. So you'll get values from array.

如果你只想要值,那么你必须使用loop(foreach,我推荐)你想要使用这个数组。所以你将从数组中获取值。

更多相关文章

  1. JS将字符串转换为数组
  2. ECMAScript6(6):数组的扩展
  3. 如何使用客户端Javascript数组并通过节点发布。将js API插入Mong
  4. Javascript日期/时间函数是否依赖于客户端机器?
  5. 在量角器中检索子元素的数组
  6. 从特定条件下存储在localStorage中的数组中删除对象?
  7. 获取指定日期的后(前)一(n)天(转)
  8. Python 3.4:试图让这个模块对这个2d数组中的销售总数求和。不工作
  9. Python:2D Numpy数组(矩阵) - 查找负数之和(行)

随机推荐

  1. Android的Activity屏幕切换动画||Gesture
  2. android RelativeLayout属性及demo
  3. Android 最火的快速开发框架XUtils
  4. Android之Http网络编程(三)
  5. Android近期学习总结——开发准备
  6. 【苦读官方文档】2.Android应用程序基本
  7. Android中的Shape使用总结—圆角的按钮
  8. android 笔记 --- Android大TXT文本文档
  9. Android中的IPC方式(二)
  10. Android 应用程序界面设计建议