Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Error #1064
DobryCover
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 22.01.2015

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


Witam, napisałem proste 4 linie z pomocą biblioteki PDO i mam błąd. jeśli wprowadzę kod PHP do SQL:
Kod
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':prid
LIMIT 0, 25' at line 1


  1. <?php
  2. require_once ('page/header.php');
  3.  
  4. $stmt = $pdo->prepare("SELECT * FROM products WHERE id = :prid");
  5. $stmt->bindValue(':prid', $prid, PDO::PARAM_INT);
  6. $stmt->execute();
  7. echo $prid;


Ten post edytował DobryCover 22.01.2015, 21:16:16
Go to the top of the page
+Quote Post
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Blad co pokazujesz dotyczy innego kodu... naprawde tego nie widzisz?
Go to the top of the page
+Quote Post
nvb
post
Post #3





Grupa: Zarejestrowani
Postów: 28
Pomógł: 3
Dołączył: 6.01.2015

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


Gdzie masz kod z częścią zapytania:

''products' WHERE id = :id
Go to the top of the page
+Quote Post
DobryCover
post
Post #4





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 22.01.2015

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


Cytat(nvb @ 22.01.2015, 20:55:39 ) *
Gdzie masz kod z częścią zapytania:

''products' WHERE id = :id


Mój błąd, wprowadziłem złe zapytanie, w każdym razie gdy zamienię id na prid, mam ten sam błąd.
Go to the top of the page
+Quote Post
nospor
post
Post #5





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Nadal podajesz nie to zapytanie.... w komunikcie bledu masz limit, a tutaj nie masz limitu... komunikat bledu nadal odnosi sie do innej czesci kodu...
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: 23.08.2025 - 08:17