php-general Digest 30 Oct 2011 12:47:33 -0000 Issue 7545

Topics (messages 315545 through 315550):

PHP syntax - novice question
        315545 by: Phil Dobbin
        315546 by: Simon J Welsh
        315547 by: Phil Dobbin

Re: create file after form completion
        315548 by: Tommy Pham

Re: What is an information_id  in directory
        315549 by: Lester Caine

Array has `trailing comma`, why not the same for function parameter list?
        315550 by: Nam Gi VU

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
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.
--
Please consider the environment before reading this email...


--- End Message ---
--- Begin 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/


--- End Message ---
--- Begin Message ---
On 30/10/11 at 01:18, si...@welsh.co.nz (Simon J Welsh) wrote:

> It seems as though your editor has changed the normal quotes around <pre> 
> into "pretty" 
> quotes. Change the ‘s and ’s back to '.

Hi, Simon.

Thanks for that. Couldn’t see for looking...

Cheers,

    Phil.
--
Please consider the environment before reading this email...


--- End Message ---
--- Begin Message ---
This line is consider 'top post'.  Meaning you're posting on top of the
reply.

On Sat, Oct 29, 2011 at 12:12 PM, Pau <vim.u...@googlemail.com> wrote:

> Hi,
>
> >
> > Please try not to top post.
>
> sorry, but I do not understand the expression (I am not native, as you
> might have guessed). Do you mean not to include the email in my reply?
> Sorry about that.
>
>
Where as this line is bottom posting.  Meaning you'd be posting
bottom/below the reply, which is the preferred method on this list.

Regards,
Tommy

--- End Message ---
--- Begin Message ---
Ernie Kemp wrote:
2 - Make a new content area in Site Manager->Content Manager. It doesn't
matter what you put in your content area, you could just put "This is my new
content area" or "Hello World" if you so choose.

3 - Grab the information_id of the new content area you made. When you are
editing a content area that already exists, the information_id can be gotten
from the update page URL.

I'm having trouble understanding this request:

1. In item #2 the client wishes to put content here, I can only guess he
means a file with text in it. ?????
2. Item #3 I know what an ID is but not in this context. I'm don't
understand what the client wishes here.??

Assuming that this is a site that is powered by a database, then one would be creating a new record in the database to store the content in rather than a new file, although one could get away with a list of files. The problem is you need to identify the next 'file/content' number, and that needs the 'information_id'. Using a database, there would be a unique index on the 'information_id' field, and you would just look up in the database to see if a number exists and pull the data from that record. Creating a new page just grabs the next 'information_id' number. One could get away by looking for the 'biggest' file number, but I suspect that 'Site Manager->Content Manager' already has some of the infrastructure to manage this?

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
It is convenient to have a trailing comma when defining an array - so as
easy to add/remove code to add/remove an entry to the array

array(
    'key00' => 'value00',
    'key01' => 'value01',
    'key02' => 'value02',
    ...
)

I suggest to PHP Development team to make it available in the syntax to
have a leading comma
array(
    ...
    , 'key00' => 'value00'
    , 'key01' => 'value01'
    , 'key02' => 'value02'
)
in such way, we can thought of the leading commas as the list bulletings.

And the same things would be lovely to be applied also to function
parameter list. I don't see why not :)

What do you thing about my suggestion? Hope to hear from you!

-- 
Nam

--- End Message ---

Reply via email to