Help with OOP PHP

Discussion in 'PHP' started by Aven, Oct 6, 2012.

  1. #1
    Hello everyone,

    I just started to learn OOP with PHP and I need to know what is wrong with this code please:

    I am using Yii framework as well.


    
    $testquestions = testquestions::model()->findAll(array('select'=>'*', 'condition'=>'test_id = :testid',  'params'=>array(':testid' => $testId),));
    
    $testmodel = tests::model()->find(array('select'=>'*', 'condition'=>'test_id = :testId ', 'params'=>array(':testId' => $testId , ),));
    
    $testquestions->question_points=$questionPoints;                                   
                                $testmodel->possible_points=$questionPoints;
                                $testmodel->save();
    
    Code (markup):
    I'm trying to get $question_points variable which is found in the column of the $testquestions table to go into the $possible_points variable which is a column in the $testmodel table.

    Is the $testquestions->question_points calling the questions_points column and getting the value? if not, how do I do that?

    Thank you!
     
    Aven, Oct 6, 2012 IP
  2. CreativeClans

    CreativeClans Peon

    Messages:
    128
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How about
    $testmodel->possible_points = $testquestions->question_points;
    Code (markup):
     
    CreativeClans, Oct 9, 2012 IP