Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $hostname='localhost';
- $username='root';
- $password='';
- try {
- $dbh = new PDO("mysql:host=$hostname;dbname=stickercollections",$username,$password);
- echo 'Connected to Database<br/>';
- $sql = "SELECT * FROM stickercollections";
- foreach ($dbh->query($sql) as $row)
- {
- echo $row["collection_brand"] ." - ". $row["collection_year"] ."<br/>";
- }
- $dbh = null;
- }
- catch(PDOException $e)
- {
- echo $e->getMessage();
- }
- ?>
- <?php
- $hostname='localhost';
- $username='root';
- $password='';
- try {
- $dbh = new PDO("mysql:host=$hostname;dbname=stickercollections",$username,$password);
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // <== add this line
- echo 'Connected to Database<br/>';
- $sql = "SELECT * FROM stickercollections";
- foreach ($dbh->query($sql) as $row)
- {
- echo $row["collection_brand"] ." - ". $row["collection_year"] ."<br/>";
- }
- $dbh = null;
- }
- catch(PDOException $e)
- {
- echo $e->getMessage();
- }
- ?>
- abfrage = "SELECT * FROM port";
- $ergebnis = mysql_query($abfrage);
- $row = mysql_fetch_object($ergebnis)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement