Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php]Unexpected $this po foreach
Forum PHP.pl > Forum > Przedszkole
NickOver
Cześć,
Mam błąd którego istnienia za bardzo nie rozumiem. Oto kod:
  1. public function remove($table = NULL, $parameters = NULL){
  2. $this->setTable($table);
  3. if($parameters === NULL){
  4. $this->displayError('You must specific parameters to use this method');
  5. exit();
  6. }
  7. if (is_array($parameters)){
  8. $whereString = null;
  9. foreach ($parameters as $field => $value){
  10. if (empty($whereString)){
  11. $whereString = " WHERE ".$field." = '".$value."'";
  12. } else {
  13. $whereString.= " AND ".$field." = '".$value."'";
  14. }
  15. }
  16. $this->_query = $this->_connection->prepare("DELETE FROM "$this->_table.$whereString);
  17. } else {
  18. $this->_query = $this->_connection->prepare("DELETE FROM "$this->_table.$paraqmeters);
  19. }
  20. return $this->_query;
  21. }

Php wywala mi "Unexpected $this ..." przy "$this->_query = $this->_connection->prepare". Wiecie może czemu?
Szymciosek
Źle łączysz stringi. Przyjrzyj się
NickOver
Kropka... Dzięki wielkie biggrin.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.