Skip to content

Instantly share code, notes, and snippets.

@frederikbosch
Created May 1, 2019 09:00
Show Gist options
  • Save frederikbosch/4360bcf7bc0cc38ab15b5efc48bdd188 to your computer and use it in GitHub Desktop.
Save frederikbosch/4360bcf7bc0cc38ab15b5efc48bdd188 to your computer and use it in GitHub Desktop.
<?php
$pdo = new PDO('mysql:dbname=floattest;host=127.0.0.1', 'root', '');
$create = $pdo->prepare('CREATE TABLE IF NOT EXISTS tbl (val DECIMAL(9,2))');
$create->execute();
$del = $pdo->prepare('DELETE FROM tbl');
$del->execute();
$ins = $pdo->prepare('INSERT INTO tbl (val) VALUES (?)');
$ins->bindValue(1, 0.5, PDO::PARAM_INT);
$ins->execute();
$sel = $pdo->prepare('SELECT * FROM tbl');
$sel->execute();
var_dump($sel->fetchColumn(0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment