PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE IF NOT EXISTS `product` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; INSERT INTO `product` (`id`, `name`) VALUES (NULL,'godzilla'); INSERT INTO `product` (`id`, `name`) VALUES (NULL,'kong');
Copy Clear
Copy Format Clear
<?php $query = "SELECT name FROM product WHERE name='god'"; $query = $pdo->prepare($query); $query->execute(); $start = microtime(true); $response = $query->fetchAll(PDO::FETCH_ASSOC); echo round((microtime(true) - $start) * 1000000, 2); echo "\n"; $query = "SELECT name FROM product WHERE name='god'"; $query = $pdo->prepare($query); $query->execute(); $start = microtime(true); $response = $query->fetch(PDO::FETCH_ASSOC); echo round((microtime(true) - $start) * 1000000, 2);
Show:  
Copy Clear