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/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php