Re: PHP syntax - novice question

From: Date: Sun, 30 Oct 2011 00:18:39 +0000
Subject: Re: PHP syntax - novice question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-315546@lists.php.net to get a copy of this message
On 30/10/2011, at 1:15 PM, Phil Dobbin wrote: > Hi, all. > > I’m new to the list & PHP in general & have a syntax question. > > I have a script that calls both DB & MDB2. This is the part of the script where the error > occurs: > > ################################################################ > > if($type == "DB") > { > $db = DB::connect($dsn); > if (PEAR::isError($db)) { die($db->getMessage()); } > $db->setFetchMode(DB_FETCHMODE_ASSOC); > $res = $db->query( 'SELECT * FROM users'); > > if (PEAR::isError($res)) { > die($res->getMessage()); > } > echo ‘<pre>’; > while( $res->fetchInto( $row ) ) { > print_R($row); > } > echo ‘</pre>’; > } else if($type == "MDB2") { > $mdb2 =& MDB2::connect($dsn); > if (PEAR::isError($mdb2)) { die($mdb2->getMessage()); } > > $res = $mdb2->query( 'SELECT * FROM users'); > > // Always check that result is not an error > if (PEAR::isError($res)) { > die($res->getMessage()); > } > > echo ‘<pre>’; > while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { > print_R($row); > } > echo ‘</pre>’; > } > > ################################################################### > > The syntax checker calls the first instance of echo ‘<pre>’; saying unexpected > > > > I’m at a loss to understand why... > > I’m using PHP 5.3.8 & PEAR 1.9.4 with MySQL 5.1.59 on Mac OS X 10.6.8. > > Any help appreciated. > > Cheers, > > Phil. It seems as though your editor has changed the normal quotes around <pre> into "pretty" quotes. Change the ‘s and ’s back to '. --- Simon Welsh Admin of http://simon.geek.nz/

« previous php.general (#315546) next »