PHP/MySql错误语句不执行 [英] Php/MySql error statement doesnt execute

查看:74
本文介绍了PHP/MySql错误语句不执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


是否可以插入发布到数据库中的多个ID,我会收到此错误

来自帖子的$ userId字段可能是一个或多个ID,现在我的问题是,当我发布多个ID时,会抛出此错误列数与第1行的值计数不匹配"," ,帮助将不胜感激

Hi
Is it possible to insert multiple id''s that are posted into a database, im getting this error

the $userId field that comes from a post could be one or more Ids, now my issue is that when i post more than 1 id it throws me this error "Column count doesn''t match value count at row 1'',", Help would be much appreciated

public function executeAction(){
    $app = Wow_Application::getInstance();
    $criteria = new Wow_Criteria_Model;
    $userId = Wow_Utility::getGPValue('selectedRows');
    $teamId = Wow_Utility::getGPValue('teamId');
    $month = Wow_Utility::getGPValue('month');
    $year = Wow_Utility::getGPValue('year');
        if(isset($_POST['selectedRows'])){
            $rows = $_POST['selectedRows'];
            foreach($rows as $key => $val){
                $criteria = new Wow_Criteria_Model;
                $criteria->load($val);
                $criteria->userId = $userId;
                $criteria->teamId = $teamId;
                $criteria->month = $month;
                $criteria->year = $year;
                $criteria->metCriteria = 1;
                $criteria->save();
            }
        }
    $results = Wow_Criteria_Model::getCriteriaMembers();
    //$html = Wow_Nomination_View_Admin::CriteriaMembers($results);
    $html = Wow_Nomination_View_Site::CriteriaMembers($results);
    $app->document->addHtmlToId('content', $html);
}

推荐答案

userId字段来自一个帖子,它可能是一个或多个ID,现在的问题是当我发布多个ID时会抛出该错误我这个错误列数与行1的值数不匹配",",帮助将不胜感激
userId field that comes from a post could be one or more Ids, now my issue is that when i post more than 1 id it throws me this error "Column count doesn''t match value count at row 1'',", Help would be much appreciated
public function executeAction(){
    


app = Wow_Application :: getInstance();
app = Wow_Application::getInstance();


条件 = Wow_Criteria_Model;
criteria = new Wow_Criteria_Model;


这篇关于PHP/MySql错误语句不执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆