Created
January 15, 2016 19:07
-
-
Save efiku/7e6e4738b7f43619b43c to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* Created by PhpStorm. | |
* User: efik | |
* Date: 15.01.16 | |
* Time: 20:03 | |
*/ | |
// Gdzieś w innym pliku połączenie do PDO. | |
/** @var $polaczenie PDO */ | |
foreach (range(0, 10) as $index) { | |
$randomNumber = mt_rand(0, 20); | |
$prepared = $polaczenie->prepare("SELECT costam,costam,costam FROM pytania WHERE id =:id"); | |
$prepared->bindParam( | |
":id", | |
$randomNumber, | |
PDO::PARAM_INT | |
); | |
if ($prepared->execute()) { | |
$question = $prepared->fetchAll(PDO::FETCH_ASSOC); | |
print_r($question); // Array(19) { ... } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment