Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
select version() as Version;
<?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());