SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL serialize causing problem

    Hi Guys..

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

    PHP Code:
    Fixed
    Any idea what's wrong with the data I am inputting?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    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
    Code MySQL:
    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

  3. #3
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I just noticed it after I posted :-)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •