2016-08-17 3 views
0

私はその見出しで多くの質問を見ました。しかし、彼らの解決策のどれもが私の問題を解決することはできませんでした。非オブジェクト上のメンバー関数bind_param()への呼び出し

public function getLiveWallPost(){ 
$acik="smthng"; 
$stmt = $this->conn->prepare("SELECT text_id,type,header,body,date FROM text WHERE type = ? order by text_id desc limit 20"); 
$stmt->bind_param("s", $acik); 
if ($stmt->execute()) { 
    $stmt->bind_result($text_id,$type,$header,$body,$date);       
    while ($stmt->fetch()) { 
     $post['text_id']=$text_id 
     $post['type']=$type; 
     $post['header']=$header; 
     $post['body']=$body; 
     $post['date']=$date; 
     $postsArray[]=$post; 
    } 
    return $postsArray; 
} 

}

この1つが正しく機能していますが、

public function getLiveWallPostNext20($id){ 
$acik="smthng"; 
$stmt = $this->conn->prepare("SELECT text_id,type,header,body,date FROM text WHERE type = ? and WHERE text_id < ? order by text_id desc limit 20"); 
$stmt->bind_param("si", $acik,$id);  //line 46 
if ($stmt->execute()) { 
    $stmt->bind_result($text_id,$type,$header,$body,$date);       
    while ($stmt->fetch()) { 
     $post['text_id']=$text_id 
     $post['type']=$type; 
     $post['header']=$header; 
     $post['body']=$body; 
     $post['date']=$date; 
     $postsArray[]=$post; 
    } 
    return $postsArray; 
} 

}

ライン46のみの違いで非オブジェクトエラーに私にbind_param()を与え、この1それらのうちの1つは1つのパラメータを使用し、他の1つは2つのパラメータを使用する。

+0

WHEREを削除しますか?注文 ' – Saty

+0

ありがとう!出来た !実際にそれは非常に単純な間違いです:) –

答えて

1
$stmt = $this->conn->prepare("SELECT text_id,type,header,body,date FROM text WHERE type = ? and text_id < ? order by text_id desc limit 20"); 

WHERE` `で`とcondition`後とWHERE text_id < `削除text_id < ?

+0

ありがとう、私はただ解決した。 :) –

関連する問題