Booking Insert Diagnostic Test


Step 1: Database Connection

✅ Database class instantiated successfully
Database class: Database

Step 2: Check getLastError Method

✅ getLastError() method exists

Step 3: Check Bookings Table Structure

✅ Bookings table exists
Table Columns:
id (int(11)) NOT NULL
booking_reference (varchar(50)) NOT NULL
tenant_id (int(11)) NOT NULL
room_id (int(11)) NOT NULL
agent_id (int(11)) NULL
booking_date (timestamp) NOT NULL
move_in_date (date) NOT NULL
duration (int(11)) NOT NULL
payment_option (enum('monthly','quarterly','biannual','annual')) NOT NULL
booking_option (enum('pay_then_inspect','inspect_then_pay')) NOT NULL
payment_location (varchar(100)) NULL
inspection_date (date) NULL
inspection_time (time) NULL
status (enum('pending','pending_payment','deposit_paid','inspection_scheduled','inspection_completed','awaiting_full_payment','payment_completed','refund_requested','refunded','cancelled','expired','active','completed','confirmed')) NOT NULL
payment_completed_at (datetime) NULL
activated_at (datetime) NULL
deposit_paid (tinyint(1)) NOT NULL
deposit_amount (decimal(10,2)) NULL
deposit_payment_date (timestamp) NULL
inspection_completed (tinyint(1)) NOT NULL
inspection_date_completed (timestamp) NULL
agreement_signed (tinyint(1)) NOT NULL
agreement_signed_date (timestamp) NULL
agreement_file (varchar(255)) NULL
created_at (timestamp) NOT NULL
updated_at (timestamp) NOT NULL
total_rent (decimal(10,2)) NOT NULL
security_deposit (decimal(10,2)) NOT NULL
booking_fee (decimal(10,2)) NOT NULL
total_amount (decimal(10,2)) NOT NULL
amount_paid (decimal(10,2)) NOT NULL
balance (decimal(10,2)) NOT NULL
currency (varchar(3)) NOT NULL
inspection_status (enum('pending','scheduled','completed','cancelled')) NULL
inspection_type (enum('virtual','onsite')) NULL
inspection_feedback (text) NULL
inspection_satisfied (tinyint(1)) NULL
refund_requested (tinyint(1)) NOT NULL
refund_amount (decimal(10,2)) NULL
refund_status (enum('pending','processing','completed','failed')) NULL
refund_date (timestamp) NULL
full_payment_deadline (timestamp) NULL
auto_refund_triggered (tinyint(1)) NOT NULL
payment_gateway_id (int(11)) NULL
hostel_option_id (int(11)) NULL
selected_occupancy (int(11)) NULL
notes (text) NULL
tenant_inspection_confirmed (tinyint(1)) NULL
landlord_inspection_confirmed (tinyint(1)) NULL
inspection_confirmed_at (datetime) NULL
payment_deadline (datetime) NULL
cancellation_reason (text) NULL
cancelled_by (int(11)) NULL
cancelled_at (datetime) NULL
refund_fee (decimal(10,2)) NULL
refund_processed (tinyint(1)) NULL
refund_processed_at (datetime) NULL

Step 4: Test Insert with Sample Data

Test Data:
Array
(
    [booking_reference] => TEST_1787910817
    [tenant_id] => 1
    [room_id] => 1
    [agent_id] => 
    [move_in_date] => 2026-09-27
    [duration] => 12
    [total_rent] => 1200
    [security_deposit] => 600
    [booking_fee] => 0
    [total_amount] => 1200
    [amount_paid] => 0
    [balance] => 1200
    [currency] => GHS
    [status] => pending_payment
    [inspection_status] => pending
    [inspection_type] => physical
    [payment_gateway_id] => 
    [hostel_option_id] => 
    [selected_occupancy] => 
    [notes] => Test booking for diagnostic purposes
)
Attempting Insert...
FAILED! Insert returned false
Database Error: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'inspection_type' at row 1

Step 5: Check PHP Error Log

Check your PHP error log for detailed error messages.
Common locations:
- XAMPP: C:\xampp\php\logs\php_error_log
- Apache: C:\xampp\apache\logs\error.log

Test Complete!

Clear Cache | Test Database Method