PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
select version() as Version;
Copy Clear
Copy Format Clear
<?php $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $pdo->exec('drop table if exists `foo`'); $pdo->exec('CREATE TABLE `foo` (`a` int unsigned not null, `b` bigint)'); $brand = 1; $id = 892373780064030720; $pdo->exec(sprintf('INSERT INTO `foo` VALUES (%d, %d)', $brand, $id)); $statement = $pdo->prepare('SELECT `b` FROM `foo` WHERE `a` = ? AND `b` = ?'); $statement->bindValue(1, 1, PDO::PARAM_INT); $statement->bindValue(2, (string) $id, PDO::PARAM_STR); $statement->execute(); var_dump($statement->fetchAll());
Show:  
Copy Clear