![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 7 Pomógł: 0 Dołączył: 29.06.2018 Ostrzeżenie: (0%) ![]() ![]() |
Witam, otóż borykam się z pewnym problemem i nie wiem co jest nie tak... Dajmy na to parametry funkcji to $table = 'users', $col = 'name' i $value = 'test'. Problem w tym, że wyskakuje komunikat:
Kod Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in XXXX on line XX PDO::errorCode(): HY093 Kod function addTo($table,$col,$value) { if($query = $this->connection->prepare("INSERT INTO :table (:col) VALUES (':value')")){ echo gettype($table); echo gettype($col); echo gettype($value); $query->bindParam(':table',$table); $query->bindParam(':col',$col); $query->bindParam(':value',$value); $query->execute(); echo "\nPDO::errorCode(): ", $query->errorCode(); } } Co może być nie tak? |
|
|
![]() ![]() |
![]() |
Aktualny czas: 20.08.2025 - 16:46 |