2012-04-03 16 views
0

コードで次のエラーが発生します。致命的なエラー:書き込みコンテキストで関数の戻り値を使用できません

Fatal error: Can't use function return value in write context in....

私が最初にこの機能で作業を開始し、エラーがreturn文に関係している1のように思えるとき、私は私が...もし、他の内側にreturn文ました。しかし私はそれらをecho文で置き換えました。私はまだエラーが出ていますので、何が起こっているのか分かりません。助けや助言?

public function wallPostComments() { 
    // This function processes wall post comments 
    // pull the submitted comment data 
    $returnedPostId = $this->inuput->post('entryId'); 
    $returnedCommentData = $this->input->post('returnedCommentData'); 

    // pull the required session data 
    $userid = $this->session->userdata('userid'); 

    // select the sql data from wallPosts and wallPostComments 
    $query = $this->db->query("SELECT * FROM wallPosts, wallPostComments"); 

    // loop through the mysql rows and process the expanded sql code 
    foreach ($query->result() as row()) { 
     if($row->idwallPosts == $JSONedIdWallPosts) { 
      echo "success"; 
     } else { 
      echo "failure"; 
     } 
    } 
} 
+0

どのように使用している 'wallPostComments()'?そのコードを表示します。 '$ JSONedIdWallPosts'はどこに定義されていますか? –

答えて

3

いつrow()が機能になりましたか?

試してみてください。

foreach ($query->result() as $row) { 
+0

ああwow笑..私はダム感じる。良いキャッチ。ありがとう! –

+0

ああ、誰もがその日を持っている、悪く感じることはありません。 –