0
setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
'u ayarladıktan sonra MySQL select sorgusu artık çalışmayacaktı, kimse nedenini biliyor mu?PDO :: ATTR_EMULATE_PREPARES issue
if($_POST)
{
$user_checkin = test_input($_POST['checkin']);
$user_checkout = test_input($_POST['checkout']);
$user_noofpeople = test_input($_POST['noofpeople']);
$user_roomtype = test_input($_POST['roomtype']);
try
{
$stmt = $db_con->prepare("
SELECT r.*
FROM system_apartment AS r
WHERE r.apartment_type = :user_roomtype
AND r.apartment_capacity >= :user_capacity
AND r.apartment_id
NOT IN
(
SELECT b.booking_apartmentid
FROM system_booking AS b
WHERE (b.booking_date_checkout >= :user_checkin AND b.booking_date_checkin <= :user_checkout)
OR (b.booking_date_checkin <= :user_checkin AND b.booking_date_checkout >= :user_checkout)
);
");
$stmt->bindParam(':user_checkin', $user_checkin, PDO::PARAM_STR);
$stmt->bindParam(':user_checkout', $user_checkout, PDO::PARAM_STR);
$stmt->bindParam(':user_roomtype', $user_roomtype, PDO::PARAM_STR);
$stmt->bindParam(':user_capacity', $user_noofpeople, PDO::PARAM_INT);
$stmt->execute();
$count = $stmt->fetchAll();
$count = count($count);
if($count==0){
echo "noapartments"; // not available
}
else{
echo "searchcomplete"; // not available
}
}
catch(PDOException $e){
echo $e->getMessage();
}
}
Özniteliği false olarak ayarlamadan önce kod gayet iyi çalışıyordu.