Created
May 1, 2019 09:00
-
-
Save frederikbosch/4360bcf7bc0cc38ab15b5efc48bdd188 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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