Code Example |
|
1 |
We start by connecting to the database before performing a select on all the data in the table. We then build a table as we loop through the data to display it on screen.
|
We have set up a very simple MySQL database using our On-Rev account with a table called 'people'. We have also entered 10 records which consist of a name, age and email address. In this example we will create a connection to the database and pull out the data stored in the 'people' table
ID | Name | Age | |
1 | Ben Beaumont | 27 | ben@runrev.com |
2 | James Johnson | 31 | james@thejohnsons.com |
3 | Michael Jordan | 50 | michael@basketballstars.com |
4 | Tony Blair | 55 | ex-priminister@theuk.com |
5 | Jonathan Edwards | 42 | triple@jump.com |
6 | Steve Jobs | 54 | steve@apple.com |
7 | Bill Gates | 53 | bill@microsoft.com |
8 | Big Bird | 34 | bigbird@thestreet.com |
9 | Ben Symes | 22 | ben.symes@runrev.com |
10 | Barack Obama | 47 | barack@theusa.com |
11 | David Brent | 54 | david@funny.com |
12 | Graeme Gooch | 66 | bat@thecricketball.com |
13 | Steven Spielberg | 62 | me@moviemaking.com |