
A set of code lines are shown in the figure. The following are the code lines:
Open angle bracket quest mark p h p
forwards slash forward slash get database connection details
require underscore once(open single inverted comma con g hyphen travel dot p h pclose inverted comma) semicolon
Forward slash Forward slash retrieve continent from querystring
dollar continent equals open inverted commaE U close inverted comma semicolon
if (isset(dollar underscore GET[ open inverted comma continentclose inverted comma])) open curly bracket dollarcontinent equals dollar underscore GET[continent] semicolon
close curly bracket
question mark close angle bracket
...
open angle bracket h1 close angle bracket Countries open angle bracket forward slash h1 close angle bracket Open angle bracket question mark p h p
try open curly bracket
dollar p d o equals new P D O (D B C O N N S T R I N G , D B U S E R , D B P A S S ) semicolon
dollar p d o hyphen close angle bracket s e t Attribute (P D O colon colon ATTR underscore ERRMODE, PDO colon colonERRMODE underscoreEXCEPTION) semicolon
forward slash forward slash construct parameterized query hyphen notice the question mark parameter
dollar s q l equals start double inverted comma SELECT asterisk FROM geocountries WHERE Continent equals question mark ORDER BY CountryName close inverted comma semicolon
forward slash forward slash run the prepared statement
dollar statement equals dollar pdo hyphen close angle bracket prepare( dollar sql) semicolon
dollar statement hyphen close angle bracket bindValue(1, dollar continent) semicolon
dollar statement hyphen close angle bracket execute() semicolon
forward slash forward slash output the list
echo makeCountryList( dollar statement) semicolon
close curly bracket
catch (PDOException dollar e) open curly bracket
die( dollar e hyphen close angle bracket getMessage() );
close curly bracket
nally open curly bracket
dollar pdo equals null semi colon
close curly bracket.
An arrow from the first set of coding blocks points to the following code lines:
open angle bracket question mark p h p
de ne(open inverted comma D B H O S Tclose inverted comma comma open inverted comma localhost close inverted comma) semicolon
de ne(open inverted comma D B NAME close inverted comma, comma open inverted comma travel close inverted comma )semicolon
de ne(open inverted comma D B U R close inverted comma comma open inverted comma testuser2close inverted comma) semicolon
de ne( open inverted comma D B PASS close inverted comma comma open inverted comma mypasswordclose inverted comma) semicolon
de ne(open inverted comma D B C O N N STRING close inverted comma comma
my sql colon host equals localhost semicolon dbname equals travel close inverted comma) semicolon
question mark close angle bracket.
A window displaying the name of the countries are shown here, at the bottom.
Back