Created
June 3, 2018 12:21
-
-
Save Petah/eab337786bf5421220d4fcdfc56b757c to your computer and use it in GitHub Desktop.
basic php
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 | |
$pdo = new PDO('mysql:host=localhost;dbname=test', 'dbuser', 'dbpassword'); |
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 | |
require_once __DIR__ . '/database.php'; | |
?> | |
<html> | |
do some html things | |
<?php | |
foreach($pdo->query('SELECT * FROM mytable') as $row) { | |
print_r($row); | |
} | |
?> | |
</html> |
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 | |
require_once __DIR__ . '/database.php'; | |
?> | |
<html> | |
do some html things | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment