Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php]Unexpected $this po foreach
NickOver
post
Post #1





Grupa: Zarejestrowani
Postów: 332
Pomógł: 10
Dołączył: 13.03.2014
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


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?
Go to the top of the page
+Quote Post
Szymciosek
post
Post #2





Grupa: Zarejestrowani
Postów: 1 168
Pomógł: 126
Dołączył: 5.02.2010
Skąd: Świdnica

Ostrzeżenie: (0%)
-----


Źle łączysz stringi. Przyjrzyj się
Go to the top of the page
+Quote Post
NickOver
post
Post #3





Grupa: Zarejestrowani
Postów: 332
Pomógł: 10
Dołączył: 13.03.2014
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


Kropka... Dzięki wielkie (IMG:style_emoticons/default/biggrin.gif)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 15:59