2015-04-19 72 views
-1
public function Extragere_tabel() 
{ 
    if($this->cuvant_cautat) 
    { 
     $cuvv=$this->cuvant_cautat; 
     $this->cuvant_cautat = $this->bd->query("SELECT cuvant_stimul, cuvant_raspuns, aparitii FROM dc_asociatii WHERE cuvant_stimul='".$this->bd->real_escape_string(trim($this->cuvant_cautat))."' OR cuvant_raspuns='".$this->bd->real_escape_string(trim($this->cuvant_cautat))."' ORDER BY aparitii DESC"); 
     echo "<br /><center><table border=1 width=500> 
     <tr><td><strong>Слово – стимул</strong></td><td><strong>Слово – реакция</strong></td><td><strong>Kоличество</strong></td></tr>"; 
     while($cuvintele = $this->cuvant_cautat->fetch_array(MYSQLI_NUM)) 
      { 
       if($this->bd->real_escape_string(trim($this->cuvant_cautat)) == $cuvintele[0]) 
        echo "<tr><td>$cuvintele[0]</td><td>$cuvintele[1]</td><td>$cuvintele[2]</td></tr>"; 
       elseif($this->bd->real_escape_string(trim($this->cuvant_cautat)) == $cuvintele[1]) 
        echo "<tr><td>$cuvintele[1]</td><td>$cuvintele[0]</td><td>$cuvintele[2]</td></tr>"; 
      } 
     echo "</table></center>"; 
    } 
} 

警告:修剪()預計參數1是字符串, C中給出對象:\ XAMPP \ htdocs中\馬達\類\用戶.Class.php上線94警告:修剪()預計參數1是串,對象給出

警告:修剪()預計參數1是串,對象在 C中給出:\ XAMPP \ htdocs中\馬達\類\ user.Class.php上線96

94行如下:

if($this->bd->real_escape_string(trim($this->cuvant_cautat)) == $cuvintele[0]) 

線96是如下:

elseif($this->bd->real_escape_string(trim($this->cuvant_cautat)) == $cuvintele[1]) 

回答

0

我解決這樣的:

public function Extragere_tabel() 
{ 
    if($this->cuvant_cautat) 
    { 
     $cuvv=$this->cuvant_cautat; 
     $this->cuvant_cautat = $this->bd->query("SELECT cuvant_stimul, cuvant_raspuns, aparitii FROM dc_asociatii WHERE cuvant_stimul='".$this->bd->real_escape_string(trim($this->cuvant_cautat))."' OR cuvant_raspuns='".$this->bd->real_escape_string(trim($this->cuvant_cautat))."' ORDER BY aparitii DESC"); 
     echo "<br /><center><table border=1 width=500> 
     <tr><td><strong>Слово – стимул</strong></td><td><strong>Слово – реакция</strong></td><td><strong>Kоличество</strong></td></tr>"; 
     while($cuvintele = $this->cuvant_cautat->fetch_array(MYSQLI_NUM)) 
      { 
       if($cuvv == $cuvintele[0]) 
        echo "<tr><td>$cuvintele[0]</td><td>$cuvintele[1]</td><td>$cuvintele[2]</td></tr>"; 
       else if($cuvv == $cuvintele[1]) 
        echo "<tr><td>$cuvintele[1]</td><td>$cuvintele[0]</td><td>$cuvintele[2]</td></tr>"; 
      } 
     echo "</table></center>"; 
    } 
} 

謝謝!

相關問題