【发布时间】:2014-01-10 17:53:02
【问题描述】:
我的日历预订系统有此代码。
public class booking_diary
{
public $bookings;
function make_booking_array($year, $month)
{
$query = "SELECT * FROM bookings WHERE date LIKE '$year-$month%'";
$result = mysqli_query($this->link, $query) or die(mysqli_error($this->link));
$this->count = mysqli_num_rows($result);
$this->bookings = '';
while ($row = mysqli_fetch_array($result)) {
$this->bookings[] = array(
"name" => $row['name'],
"date" => $row['date'],
"start" => $row['start'],
"comments" => $row['comments'],
"adminBooked" => $row['admin']
);
}
$this->make_day_boxes($this->days, $this->bookings, $this->month, $this->year);
} // Close function
function make_day_boxes()
{
// I want to access $bookings['adminBooked'] in this function
}
}
在make_day_boxes()函数中我尝试访问$bookings['adminBooked']
但是我得到了索引 adminBooked 未定义的错误
谁能告诉我如何访问存储在“adminBooked”中的值?
//为什么这里的大多数人都反对我。如果我在这里学习并提出我的问题和疑问有什么问题????
【问题讨论】:
标签: php html associative-array