简体   繁体   中英

PHP Key value FOREACH

Ok I have a file that is trying to retrive job numbers out of a database call and then put them into key value pairs to return to my jquery function that will export them to my page. I am getting a 500 error when I try to run the page and it is on this page. What am I doing wrong with this output/call?

$output = new array();
$job = new job;
$jobs = $job->get_from_db( "`code` = '" . $_GET['term'] . "'" );

foreach ( $jobs as $key => $current)
    {
        $output[$key]['value'] = $current->code;
        $output[$key]['id'] = $current->id;
    }
echo json_encode($output);

查看日志-/var/logs/apache2/error.log并检查(过滤器)$ _ GET ['term']是否注入

500表示通常尝试chmod 777权限

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM