![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 18 Pomógł: 0 Dołączył: 18.09.2020 Ostrzeżenie: (0%) ![]() ![]() |
Wywala mi oto taki błąd:
Warning: PDOStatement::fetchAll() expects parameter 1 to be int, string given in C:\xampp\htdocs\testowa\rejestracja\registration.php on line 37 Czepia się tego: $result = $statement->fetchAll('fetch_style: PDO::FETCH_ASSOC'); cała funkcja: $statement = $connection->prepare('statement: SELECT * FROM user WHERE email = :email OR numer = :numer'); if($statement){ $result = $statement->execute([ ':email' => $data['email'], ':numer' => $data['phone'], ]); $result = $statement->fetchAll('fetch_style: PDO::FETCH_ASSOC'); if(!empty($result)){ $_SESSION['messages'] [] = 'Podany adres e-mail lub numer telefonu jest już przypisany do konta'; header('string: Location: register.php'); exit; } } Czy ktoś wie jak mogę to naprawić? Z góry dziękuję za pomoc ![]() |
|
|
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 6 380 Pomógł: 1116 Dołączył: 30.08.2006 Ostrzeżenie: (0%) ![]() ![]() |
A co to niby za przedrostki fetch_style, statement? PDO::FETCH_ASSOC to stała a nie string
$result = $statement->fetchAll(\PDO::FETCH_ASSOC); -------------------- |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 18 Pomógł: 0 Dołączył: 18.09.2020 Ostrzeżenie: (0%) ![]() ![]() |
A co to niby za przedrostki fetch_style, statement? PDO::FETCH_ASSOC to stała a nie string $result = $statement->fetchAll(\PDO::FETCH_ASSOC); Dopiero uczę się php i skorzystałem z tego poradnika: https://magemastery.net/courses/user-regist...in-the-database Dziękuję za pomoc ![]() |
|
|
![]()
Post
#4
|
|
Grupa: Zarejestrowani Postów: 6 806 Pomógł: 1828 Dołączył: 11.03.2014 Ostrzeżenie: (0%) ![]() ![]() |
Jeśli używasz głównie FETCH_ASSOC, to możesz ustawić to sobie zaraz po połączeniu z bazą danych.
Nie będziesz musiał wpisywać tego za każdym razem. -------------------- |
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 03:45 |