更改 mysql 查询后出现 500 内部服务器错误

发布于 2024-12-20 04:14:33 字数 3245 浏览 1 评论 0原文

昨天,我更改了数据库架构,并因此更改了应用程序中的数据库查询,从那时起,我一直收到 500 个内部服务器错误。我不认为问题在于查询,因为我可以从我的模型运行它,并从我的控制器打印数组。问题似乎出在构建模板时。

下面是我的代码,

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);

我的错误日志中的错误如下所示,

[2011 年 12 月 9 日星期五 10:28:49] [错误] [客户端 xx.xx.xx.xxx] 格式错误 标题来自 脚本。错误标头=Bs%3A2%3A%2259%22%3Bs%3A10%3A%:index.php,引荐来源:http://urbantalent.factoryagency.co.uk/search

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

遗弃M 2024-12-27 04:14:33

我最好的猜测是您试图将太多内容放入 ci_session cookie 中。
那里的一些值可能没有正确编码,并且看起来不像有效的标头。 set-cookie HTTP 标头将是错误的,因此您会收到“格式错误的标头”错误。
首先限制此 cookie 中的内容。如果可以的话,也许禁用/根本不使用它(暂时在调试代码时)

然后修复动态 SQL - 每个“AND”前面需要空格

。性别可能也应该用双引号引起来。

编辑:
是的,现在我更加确信了。
sico87 - 这是从您的网站实时发布的(见下文 - 抱歉字符串很长)。
这个cookie的大小接近8K。 HTTP 标头的大小有一定的限制。从 Apache 的内存来看,它是 8K。
所以我最好的猜测(是的,猜测!)是,在某些情况下,您在 cookie 中放入了超过 8K 的内容,并且此请求失败。解决方案是不使用 cookie 来存储/传输大量数据。

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

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
笨死的猪 2024-12-27 04:14:33

首先,echo() SQL语句(然后die(),避免遇到错误),并在SQL工具中尝试一下,看看会发生什么。我认为,这是一个有错误的 SQL 语句,或者只是 SQL 引擎由于某种原因不喜欢它 - 所以你应该尝试获取详细的错误消息,而不是“500 内部服务器错误”。

First of all, echo() the SQL statement (then die(), avoid to run into the error), and try it in a SQL tool, to see what happens. I think, it's a buggy SQL statement, or just the SQL engine does not like it for some reason - so you should try to get a detailed error message, instead of the "500 Internal Server error".

春夜浅 2024-12-27 04:14:33

也许你需要将其更改

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; }

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; }

Maybe you need to change this

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; }

to

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; }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文