So I have this PHP code to create a table. It should create a table called test101_list1, but instead it creates a table called 'test101'_'list1'. Without the backslash, PDO will see it as :username_ instead of :username. Also, I'd like to get rid of the quotes around the username and list name, but I still want to sanitize the input, as it uses user input. How can I do this?
$stmt = $db->prepare("CREATE TABLE `lists`.`:username\_:listname` ( `id` INT(10) NOT NULL AUTO_INCREMENT , `lang1` TEXT NOT NULL , `lang2` TEXT NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB CHARSET=utf8 COLLATE utf8_general_ci;");
$stmt->bindParam(':username', $username);
$stmt->bindParam(':listname', $listname);
$username = "test101";
$listname = "list1";
$stmt->execute();