Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6955895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:47:49+00:00 2026-05-27T14:47:49+00:00

Yesterday I changed my database schema, and consequently a database query in my application,

  • 0

Yesterday I changed my database schema, and consequently a database query in my application, since then I have been receiving 500 Internal Server Errors. I do not think that the problem is the query, as I can run it from my model, and print the array from my controller. The problem seems to be when building the template.

Below is my code,

MODEL

public function searchCandidates($type=null, $gender=null, $age=null)
    {
        if($age != "0") {
            $age = implode(", %",$age);
        }

        $sql = 'SELECT `candidates`.`candidate_id`, 
                        `candidates`.`first_name`, 
                        `candidates`.`surname`, 
                        `candidates`.`DOB`, 
                        `candidates`.`gender`, 
                        `candidates`.`talent`, 
                        `candidates`.`location`, 
                        `candidates`.`availability`,
                        `candidates`.`youtube_showreel_1`,
                        `candidates`.`youtube_showreel_2`,
                        `candidates`.`youtube_showreel_3`,
                        `candidates`.`youtube_showreel_4`,
                        `candidates`.`youtube_showreel_5`,
                        `candidates`.`youtube_showreel_desc_1`,
                        `candidates`.`youtube_showreel_desc_2`,
                        `candidates`.`youtube_showreel_desc_3`,
                        `candidates`.`youtube_showreel_desc_4`,
                        `candidates`.`youtube_showreel_desc_5`,
                        `candidates`.`date_created`,
                         DATE_FORMAT(NOW(), "%Y") - DATE_FORMAT(`candidates`.`DOB`, "%Y") - (DATE_FORMAT(NOW(), "00-%m-%d") < DATE_FORMAT(`candidates`.`DOB`, "00-%m-%d")) as `age`,
                        `candidate_assets`.`url`, 
                        `candidate_assets`.`asset_size`
                FROM `candidates`
                LEFT JOIN `candidate_assets` ON `candidate_assets`.`candidates_candidate_id` = `candidates`.`candidate_id`
                WHERE `candidates`.`availability` = "yes"';
                //is there a certain criteria
                if($type != "0") { $sql .= 'AND `candidates`.`talent` = '.$type; }
                if($age != "0") { $sql .= 'AND `candidates`.`playing_age` LIKE "%'.$age.'%"';}
                if($gender != false){ $sql .= 'AND `candidates`.`gender` = '.$gender; }
                $sql .= ' GROUP BY `candidates`.`candidate_id`';

        $query = $this->db->query($sql);

        //die(print_r($query->result_array()));

        //die($this->db->last_query());
        return $query->result_array();
    }

CONTROLLER

$data['results'] = 

$this->candidates_model->searchCandidates($this->input->post('type'), $this->input->post('gender'), $this->input->post('age')); 
            $this->session->set_userdata('search', $data['results']);
            //die(print_r($this->session->userdata('search')));
            $this->template->build('search/results', $data);

The error in my error logs looks like this,

[Fri Dec 09 10:28:49 2011] [error] [client xx.xx.xx.xxx] malformed
header from
script. Bad header=Bs%3A2%3A%2259%22%3Bs%3A10%3A%: index.php, referer: http://urbantalent.factoryagency.co.uk/search

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:47:50+00:00Added an answer on May 27, 2026 at 2:47 pm

    My best guess is that you are trying to put too many things into the ci_session cookie.
    Some of the values there might not be encoded properly and don’t look like a valid header. set-cookie HTTP header will then be wrong hence you get the “malformed header” error.
    Start by limiting WHAT goes into this cookie. Perhaps disable/don’t use it at all if you can (temporarily while you debug your code)

    Then fix the dynamic SQL – you need space in front of each “AND”

    .gender should probably also be wrapped in double quotes.

    EDIT:
    Yes, now I am even more convinced.
    sico87 – This is live from your site (see below – sorry for a very long string).
    The size of this cookie is close to 8K. There are certain limits on the size of HTTP headers. And from memory for Apache it is 8K.
    So my best guess (yes, guess!) is that under certain circumstances you put more than 8K in the cookie and this request fails. The solution is to not use cookies to store/transfer large volumes of data.

    ci_session=a%3A5%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22f80a32998134fc9d24ee7cf0ee41592a%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A13%3A%2299.99.99.99%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A70%3A%22Mozilla%2F5.0+%28compatible%3B+MSIE+9.0%3B+Windows+NT+6.1%3B+WOW64%3B+Trident%2F5.0%29%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1323429638%3Bs%3A7%3A%22search1%22%3Ba%3A15%3A%7Bi%3A0%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2252%22%3Bs%3A10%3A%22first_name%22%3Bs%3A4%3A%22Eric%22%3Bs%3A7%3A%22surname%22%3Bs%3A10%3A%22James+Dean%22%3Bs%3A6%3A%22gender%22%3Bs%3A4%3A%22male%22%3Bs%3A6%3A%22talent%22%3Bs%3A5%3A%22actor%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A42%3A%22http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5OIiZLo50Hc%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-24+12%3A06%3A53%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2256%22%3Bs%3A3%3A%22url%22%3Bs%3A27%3A%22resized_Eric_Dean_web_1.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A1%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2253%22%3Bs%3A10%3A%22first_name%22%3Bs%3A7%3A%22Matthew%22%3Bs%3A7%3A%22surname%22%3Bs%3A8%3A%22Holbrook%22%3Bs%3A6%3A%22gender%22%3Bs%3A4%3A%22male%22%3Bs%3A6%3A%22talent%22%3Bs%3A5%3A%22actor%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A42%3A%22http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DZBJPV2YnXvk%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-24+09%3A40%3A38%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2230%22%3Bs%3A3%3A%22url%22%3Bs%3A28%3A%22resized_Matthew_Holbrook.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A2%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2254%22%3Bs%3A10%3A%22first_name%22%3Bs%3A5%3A%22Steve%22%3Bs%3A7%3A%22surname%22%3Bs%3A6%3A%22Murphy%22%3Bs%3A6%3A%22gender%22%3Bs%3A4%3A%22male%22%3Bs%3A6%3A%22talent%22%3Bs%3A5%3A%22actor%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A0%3A%22%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-18+10%3A06%3A43%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2245%22%3Bs%3A3%3A%22url%22%3Bs%3A24%3A%22resized_Steve_Murphy.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A3%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2255%22%3Bs%3A10%3A%22first_name%22%3Bs%3A7%3A%22Anthony%22%3Bs%3A7%3A%22surname%22%3Bs%3A5%3A%22Berry%22%3Bs%3A6%3A%22gender%22%3Bs%3A4%3A%22male%22%3Bs%3A6%3A%22talent%22%3Bs%3A5%3A%22actor%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A42%3A%22http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DGXB4_Q6oNUk%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-23+05%3A40%3A51%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2230%22%3Bs%3A3%3A%22url%22%3Bs%3A25%3A%22resized_Anthony_Berry.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A4%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2256%22%3Bs%3A10%3A%22first_name%22%3Bs%3A4%3A%22Emma%22%3Bs%3A7%3A%22surname%22%3Bs%3A5%3A%22Beard%22%3Bs%3A6%3A%22gender%22%3Bs%3A6%3A%22female%22%3Bs%3A6%3A%22talent%22%3Bs%3A5%3A%22actor%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A42%3A%22http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DfUBF8L9pV1Q%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-23+05%3A41%3A45%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2228%22%3Bs%3A3%3A%22url%22%3Bs%3A28%3A%22resized_Emma_Beard_web_1.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A5%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2257%22%3Bs%3A10%3A%22first_name%22%3Bs%3A10%3A%22John-Henry%22%3Bs%3A7%3A%22surname%22%3Bs%3A6%3A%22Carter%22%3Bs%3A6%3A%22gender%22%3Bs%3A4%3A%22male%22%3Bs%3A6%3A%22talent%22%3Bs%3A5%3A%22actor%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A0%3A%22%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-23+05%3A42%3A19%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2234%22%3Bs%3A3%3A%22url%22%3Bs%3A35%3A%22resized_John_Carter_website_pic.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A6%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2258%22%3Bs%3A10%3A%22first_name%22%3Bs%3A7%3A%22Melanie%22%3Bs%3A7%3A%22surname%22%3Bs%3A5%3A%22Clare%22%3Bs%3A6%3A%22gender%22%3Bs%3A6%3A%22female%22%3Bs%3A6%3A%22talent%22%3Bs%3A5%3A%22actor%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A0%3A%22%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-23+05%3A42%3A52%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2242%22%3Bs%3A3%3A%22url%22%3Bs%3A18%3A%22resized_images.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A7%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2259%22%3Bs%3A10%3A%22first_name%22%3Bs%3A7%3A%22Phoenix%22%3Bs%3A7%3A%22surname%22%3Bs%3A3%3A%22Lee%22%3Bs%3A6%3A%22gender%22%3Bs%3A4%3A%22male%22%3Bs%3A6%3A%22talent%22%3Bs%3A9%3A%22presenter%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A0%3A%22%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-24+09%3A15%3A08%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2231%22%3Bs%3A3%3A%22url%22%3Bs%3A36%3A%22resized_Phoenix_Lee_-_14.10_.04_.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A8%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2260%22%3Bs%3A10%3A%22first_name%22%3Bs%3A5%3A%22Holly%22%3Bs%3A7%3A%22surname%22%3Bs%3A5%3A%22Bryan%22%3Bs%3A6%3A%22gender%22%3Bs%3A6%3A%22female%22%3Bs%3A6%3A%22talent%22%3Bs%3A9%3A%22presenter%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A0%3A%22%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-24+09%3A30%3A32%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2223%22%3Bs%3A3%3A%22url%22%3Bs%3A29%3A%22resized_Holly_Bryan_web_1.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A9%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2261%22%3Bs%3A10%3A%22first_name%22%3Bs%3A5%3A%22Susie%22%3Bs%3A7%3A%22surname%22%3Bs%3A4%3A%22Juul%22%3Bs%3A6%3A%22gender%22%3Bs%3A6%3A%22female%22%3Bs%3A6%3A%22talent%22%3Bs%3A9%3A%22presenter%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A0%3A%22%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-24+09%3A31%3A56%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2254%22%3Bs%3A3%3A%22url%22%3Bs%3A28%3A%22resized_Susie_Juul_web_1.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A10%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2262%22%3Bs%3A10%3A%22first_name%22%3Bs%3A4%3A%22Neil%22%3Bs%3A7%3A%22surname%22%3Bs%3A7%3A%22Lumberg%22%3Bs%3A6%3A%22gender%22%3Bs%3A4%3A%22male%22%3Bs%3A6%3A%22talent%22%3Bs%3A9%3A%22presenter%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A42%3A%22http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7QDWDtm3tgs%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-24+09%3A32%3A34%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2227%22%3Bs%3A3%3A%22url%22%3Bs%3A30%3A%22resized_Neil_Lumberg_web_1.jpg%22%3Bs%3A10%3A%22asset_size%22%3Bs%3A5%3A%22large%22%3B%7Di%3A11%3Ba%3A12%3A%7Bs%3A12%3A%22candidate_id%22%3Bs%3A2%3A%2263%22%3Bs%3A10%3A%22first_name%22%3Bs%3A5%3A%22Megan%22%3Bs%3A7%3A%22surname%22%3Bs%3A7%3A%22Roberts%22%3Bs%3A6%3A%22gender%22%3Bs%3A6%3A%22female%22%3Bs%3A6%3A%22talent%22%3Bs%3A9%3A%22presenter%22%3Bs%3A12%3A%22availability%22%3Bs%3A3%3A%22yes%22%3Bs%3A18%3A%22youtube_showreel_1%22%3Bs%3A0%3A%22%22%3Bs%3A23%3A%22youtube_showreel_desc_1%22%3BN%3Bs%3A12%3A%22date_created%22%3Bs%3A19%3A%222011-11-24+09%3A33%3A16%22%3Bs%3A3%3A%22age%22%3Bs%3A2%3A%2214%22%3Bs%3A3%3A%22url%22%3B
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Up until yesterday I have been happily connecting to SQL Server Express 2005 using
Yesterday I changed the application settings and enabled New Data Permissions and New SDKs.
Yesterday, after about two years we re-deployed our application. Code hasn't changed, but the
(Advantage Database Server) I have a table of service providers that, for auditing purposes,
Since yesterday a working Python gdata program has stopped working after I changed the
This script hasn't changed since yesterday when it was working and I used it
So I asked this question yesterday, but the goal posts have changed and the
Yesterday, I have a discussion with my colleagues about HTTP. It is asked why
yesterday you had taught me to query record history within a time range here
I have a query with about 6-7 joined tables and a FREETEXT() predicate on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.