1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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