Click here to Skip to main content
16,011,702 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
PHP
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);
}
Posted
Updated 28-Mar-12 3:54am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900