0

Why I can't use bindValue param name like utf8 charset name

$db = new PDO('mysql:host=localhost;dbname=username;charset=UTF8','root','');
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $stmt = $db->prepare('SELECT * FROM so31349641 WHERE użytkownik= :użytkownik');
    $stmt->bindValue(':użytkownik', $nazwaużytkownika, PDO::PARAM_STR);
    $stmt->execute();

This code give me error:

SQLSTATE[HY093]: Invalid parameter number: parameter was not defined

So when I change this value :użytkownik to uzytkownik then all working fine. Is there any option to use parameter name like UTF8 name?

MESSIAH
  • 19
  • 6
  • It just wasn't designed to accept Unicody placeholders. (You might try with native prepared statements instead of `PDO::ATTR_EMULATE_PREPARES`. But I doubt MySQL allows it either.) – mario Jul 14 '15 at 19:31
  • Many thanks for help and explaining. – MESSIAH Jul 14 '15 at 20:31

0 Answers0