$fetchedData = $query->fetchAll(PDO::FETCH_ASSOC);
returns
0 = {array} [8]
candidate_id = "2"
candidate_name = "Christine Hill"
company_id = "1"
end_date = "2016-09-30"
home_city = "Salisbury"
job_id = "8"
skill_id = "3"
start_date = "2016-01-01"
although some fields (candidate_id, company_id, job_id, skill_id) are declared as int(11)
in the MySql database.
I want to treat them as integer in PHP, and return them as so in JSON over my AJAX interface.
Am I doing something wrongly? Is there some way to avoid repeated casts in PHP and have PDO return the same type as in the database?