Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]PDO problem z bindParam.
Gruchol
post 12.02.2016, 21:04:26
Post #1





Grupa: Zarejestrowani
Postów: 242
Pomógł: 0
Dołączył: 28.11.2014

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


Witam,

Mam takie zapytanie:

  1. $id_img = "b";
  2. $email = "a@mail.com";
  3.  
  4. $a = $db->prepare("INSERT INTO `baza`.`b` (`id`, `name`, `owner`, `ad_id`) VALUES (NULL, ':id_img', ':email', '5')");
  5. $a->bindParam(':id_img', $id_img);
  6. $a->bindParam(':email', $email);
  7. $a->execute();


i do bazy dodaje mi :id_img oraz :email.
Co robię źle?
Pozdrawiam.

@Edit
Rozwiązane,
Zapomniałem usunąć '' z zapytania.

Ten post edytował Gruchol 12.02.2016, 22:16:17
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
goartur
post 12.02.2016, 23:21:32
Post #2





Grupa: Zarejestrowani
Postów: 233
Pomógł: 27
Dołączył: 19.10.2014

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


  1. $a = $db->prepare("INSERT INTO `baza`.`b` (`id`, `name`, `owner`, `ad_id`) VALUES (NULL, :id_img, :email, '5')");

To nie jest string wiec usun ' '
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 01:44