SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | $dbh = new PDO('mysql:host=localhost;dbname=reddit','root',""); | |
3 | - | function reddit($select) { |
3 | + | $dbh->query($result="SELECT id,title,user,subreddit,url from posts"); |
4 | - | $dbh->query($result="SELECT id,title,user,subreddit,url from posts"); |
4 | + | foreach ($select->query($result) as $row) { |
5 | - | foreach ($select->query($result) as $row) { |
5 | + | print $row['id']. "<br>"; |
6 | - | print $row['id']. "\t"; |
6 | + | print $row['title']. "<br>"; |
7 | - | print $row['title']. "\t"; |
7 | + | |
8 | - | } |
8 | + |