我需要從new_guest
表得到guest_id
其中柱guest_nic_pp_dl
是等於變量guest_nic_pp_dl
和LIMIT
到1個結果的查詢。然而,我寫的代碼以一個愚蠢的語法錯誤結束。我如何定義WHERE與變量值匹配行?
Parse error: syntax error, unexpected '$guest_nic_pp_dl' (T_VARIABLE) in C:\xampp\htdocs\bit\application\models\reservations_model.php on line 20
$query = $this->db->query('SELECT guest_id FROM new_guest WHERE guest_nic_pp_dl, '$guest_nic_pp_dl' LIMIT 1'); // Line 20
foreach ($query->result() as $row) {
return $row->guest_id;
WHERE guest_nic_pp_dl = '$ guest_nic_pp_dl' – sinisake
還是同樣的錯誤:( –