Php Error in code something to do with parameters i think

Discussion in 'PHP' started by ianlufc, Nov 28, 2007.

  1. #1
    Error is :
    Fatal error: Call to a member function add() on a non-object in C:\Users\Ian\Documents\College\BSHSS\BSHSS4\server2go\htdocs\projectBookstore\phpModelerExtHopefully.php on line 149
    piece of code below:

    function addStatements($sub,$pre,$lit){
    $statement1 = new Statement(new Resource("http://www.w3.org/Home/Lassila"),
    new Resource("http://description.org/schema/Description"),
    new Literal("Lassilas persönliche Homepage "));
    addS($statement1);
    }

    function addS($state1){
    $statement2add = $state1;
    $model->add($statement2add);//error here just when it goes to add to rdf model
    }

    i get the error just when i go to add..
    basically im trying to add statements to an rdf model so i declare and define statement1....pass it to addS function ....rename it......then try add it and get above error

    any help Much appreciated!

    Ian
     
    ianlufc, Nov 28, 2007 IP
  2. ianlufc

    ianlufc Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if i am to take all code out of functions and use as below it works BUT i need it in functions as im adding many statements

    $statement1 = new Statement(new Resource("http://www.w3.org/Home/Lassila"),
    new Resource("http://description.org/schema/Description"),
    new Literal("Lassila's personal Homepage", "en"));

    $model->add($statement1);
     
    ianlufc, Nov 28, 2007 IP