【发布时间】:2020-12-12 11:58:18
【问题描述】:
我想创建一个函数,从从 booking.booking_id 获取的控制器端函数中的给定 $id 参数更新 client.client_status 数据
这是我的控制器
function end($book_id = null) {
if (!empty($book_id)) {
// Booking Table
$table = 'booking';
$where = [
'book_id' => $book_id,
];
$data = [
'room_status' => 1,
];
$this->Model_Data->booking_update($table, $where, $data);
// Client Table
$table = 'client';
$client_id = $???????; // How to get booking.client_id from given id parameters
$where = [
'client_id' => $client_id,
];
$data = [
'room_status' => 1,
];
$this->Model_Data->booking_update($table, $where, $data);
$this->session->set_flashdata('book_ended', 'Book Ended');
redirect('book');
}
else {
$this->session->set_flashdata('book_end_error', 'Book End Error');
redirect('book');
}
}
这是我的 SQL 表
【问题讨论】:
-
在
booking table中是否有client_id列?? -
是 booking.book_by_client_id
标签: php mysql codeigniter codeigniter-3