MySQL serialize causing problem

Hi Guys…

I have the following MySQL query, that’s throwing the error below:

Fixed.

Any idea what’s wrong with the data I am inputting?

Thanks, I just noticed it after I posted :slight_smile:

You’ve got single quotes in some of the names in that jobs.location string value, and those single quotes end the string. Try escaping them (see code below) or, if you’re creating and executing this query in PHP, pass the values through mysql_real_escape_string


select jobs.job_title, companies.company_name, companies.company_url, companies.logo_thumbnail, jobs.job_url, jobs.job_salary, jobs.job_ote, jobs.job_perks, jobs.job_description, jobs.location, jobs.date_posted, industries.industry, job_types.job_type, count(applications.id) as applications, count(featured_jobs.id) as featured 
	from jobs 
    inner join companies on companies.id = jobs.company_id 
    inner join industries on industries.id = jobs.industry 
    inner join job_types on job_types.id = jobs.job_type 
    left outer join applications on applications.job_id = jobs.id 
    left outer join featured_jobs on featured_jobs.job_id = jobs.id 
    where jobs.status='on' and jobs.location like '%a:19:{i:0;s:8:"Finsbury";i:1;s:16:" Finsbury Estate";i:2;s:13:"Hatton Garden";i:3;s:11:"Fetter Lane";i:4;s:11:"Clerkenwell";i:5;s:11:" Farringdon";i:6;s:28:"Great Ormond Street Hospital";i:7;s:11:"Kings Cross";i:8;s:16:" Finsbury (west)";i:9;s:25:"St Bartholomew\\'s Hospital";i:10;s:10:"Gray\\'s Inn";i:11;s:6:"Temple";i:12;s:12:"High Holborn";i:13;s:9:"St Paul\\'s";i:14;s:9:"St Luke\\'s";i:15;s:15:" Bunhill Fields";i:16;s:8:"Barbican";i:17;s:10:"St Pancras";i:18;s:9:"Guildhall";}%' 
    group by jobs.id 
    order by featured desc, date_posted desc