Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]PDO UPDATE problem, jw
miras
post
Post #1





Grupa: Zarejestrowani
Postów: 1 004
Pomógł: 9
Dołączył: 18.01.2011
Skąd: Siedlce

Ostrzeżenie: (30%)
XX---


  1. public function update_weather($id, $data) {
  2. if (!empty($_POST['check'])) {
  3. $i = 0;
  4. $len = count($data);
  5. foreach($data as $name => $val):
  6. if ($i!=$len-1) {
  7. if ($i==$len-2) {
  8. $n .= $name.'=?';
  9. $v .= $val;
  10. } else {
  11. $n .= $name.'=?,';
  12. $v .= $val.",";
  13. }
  14. }
  15. $i++;
  16. endforeach;
  17.  
  18. $this->activ = $this->pdo->prepare("UPDATE weather SET $n WHERE id=?");
  19. $this->activ->execute(array($v, $id));
  20.  
  21. }
  22. }



Błąd:

Invalid parameter number: number of bound variables does not match number of tokens' in ....

Ma ktoś pomysł?
Go to the top of the page
+Quote Post

Posty w temacie


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: 14.09.2025 - 16:13