Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
select version() as Version;

Stuck with a problem? Got Error? Ask AI support!

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());
Copy Clear