You should see a table of the locations below
- Uses PHP Data Object (PDO) to make the data connection
- Since PDO can throw errors (halts code) and exceptions (might still proceed), we can put our Db code in a try block with a catch to follow
- In this case we catch specifically any PDOException and write the error message.
- We create a connection object using PDO, passing the host, db name, username and password (you might have to change the last two
- For attributes we set ATTR_ERRMODE and ERRMODE_EXCEPTION. PDO will handle errors pretty effectively so you don't always need a catch but in this case for the connection it will reveal issues such as bad password.
- PDO can return a number of different ways, here we just use an associative array. IE an array where we can use the keys instead of just the indecies
| Id | Type | Name | Street | City | Region | Code | Phone | Website |
|---|
| 1 | BAR | The Place | 6056 Stanton Dr SW | Edmonton | AB | T6X 0H1 | (587) 463-6869 | theplace.ca |
| 2 | BAR | Bar Five | 2130 Jordan Dr | Burnaby | BC | V5B-4E8 | (604) 420-3087 | www.five.ca |
| 3 | BAR | Shipyard Pub | 3308 Ash St | Vancouver | BC | V5Z 3E3 | (604) 689-2577 | www.theoldshipyard.ca |
| 4 | BAR | Slow Arrow Brewhouse | 6912 Lefroy Crt SW | Calgary | AB | T3E 6G9 | (403) 280-2405 | www.slowarrow.ca |
| 5 | BAR | Hoppy Barman Garage | 272 Huntington Close NE | Calgary | AB | T2K 5B3 | (403) 242-1274 | hoppy.ca |
| 6 | RESTAURANT | The French Quarter | 2485 Broadway W 414 | Vancouver | BC | V6K 2E8 | (604) 736-8018 | www.frenchqtr.ca |
| 7 | RESTAURANT | Dizzy Crown Eatery | 13352 Old Yale Rd 620 | Surrey | BC | V3T 5A4 | (604) 582-4185 | dizzyeats.ca |
| 8 | RESTAURANT | Cheerful Rhino | 121 Wildwood CPk | Winnipeg | MB | R3T 0E1 | (204) 452-2482 | www.cheerfulrhino.ca |
| 9 | HALL | South Burnaby Community Hall | 5202 Union St | Burnaby | BC | V5B-1W3 | (604) 298-0773 | sbca.org |
| 10 | HALL | Knights of Nee Hall | 918 Collinson St 510 | Victoria | BC | V8V 4V5 | (250) 361-4245 | knights.org |