0 0 ], ▁▁▁▁▁▁▁▁ ▁[' sh o es ', ▁ 7 4 0 0 ], ▁▁▁▁▁▁▁▁ ▁[' phone ', ▁ 2 9 5 0 0 ], ▁▁▁▁ ▁]; ▁▁▁▁▁ ▁// ▁Iter ate ▁through ▁the ▁products ▁in ▁the ▁" products " ▁array , ▁and ▁▁▁▁ ▁// ▁execute ▁the ▁prepared ▁statement ▁for ▁each ▁product ▁▁▁▁ ▁foreach ▁($ products ▁as ▁$ product ) ▁{ ▁▁▁▁▁▁▁▁ ▁$ statement -> execute ($ product ); ▁▁▁▁ ▁} ▁▁▁▁▁ ▁// ▁P rep are ▁a ▁new ▁statement ▁with ▁a ▁named ▁parameter ▁▁▁▁ ▁$ statement ▁= ▁$ connection -> prepare (' SELECT ▁* ▁FROM ▁products ▁WHERE ▁name ▁= ▁: name '); ▁▁▁▁ ▁$ statement -> execute ([ ▁▁▁▁▁▁▁▁ ▁' : name ' ▁=> ▁' sh o es ', ▁▁▁▁ ▁] ); ▁▁▁▁▁ ▁// ▁Use ▁array ▁destruct uring ▁to ▁assign ▁the ▁product ▁name ▁and ▁its ▁price ▁▁▁▁ ▁// ▁to ▁corresponding ▁variables ▁▁▁▁ ▁[ ▁$ product , ▁$ price ▁] ▁= ▁$ statement -> fetch (); ▁▁▁▁▁ ▁// ▁Display ▁the ▁result ▁to ▁the ▁user ▁▁▁▁ ▁echo ▁" The ▁price ▁of ▁the ▁product ▁{$ product } ▁is ▁\ ${ $ price } ." ; ▁▁▁▁▁ ▁// ▁Close ▁the ▁cursor ▁so ▁` fetch ` ▁can ▁eventually ▁be ▁used ▁again ▁▁▁▁ ▁$ statement -> close Cursor (); ▁} ▁catch ▁(\ Exception ▁$ e ) ▁{ ▁▁▁▁ ▁echo ▁' An ▁error ▁has ▁occurred : ▁' ▁. ▁$ e -> getMessage (); ▁} ▁ ▁Perl ▁DB I ▁ ▁This ▁example ▁uses ▁Perl ▁and ▁DB I : ▁ ▁#!/ usr / bin / perl ▁- w ▁use ▁strict ; ▁use