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.

 

DATABASES
Basic database interaction

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

 

Dynamic Result (Pulled from database)

IDNameAgeEmail
1Ben Beaumont27ben@runrev.com
2James Johnson31james@thejohnsons.com
3Michael Jordan50michael@basketballstars.com
4Tony Blair55ex-priminister@theuk.com
5Jonathan Edwards42triple@jump.com
6Steve Jobs54steve@apple.com
7Bill Gates53bill@microsoft.com
8Big Bird34bigbird@thestreet.com
9Ben Symes22ben.symes@runrev.com
10Barack Obama47barack@theusa.com
11David Brent54david@funny.com
12Graeme Gooch66bat@thecricketball.com
13Steven Spielberg62me@moviemaking.com