SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    Greenville, SC
    Posts
    388
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Kevins book: New vs. Old

    Hello all, I 'm reading Kevins book (borrowed it from a friend) and I love it. Only thing is, I have the first version. It seems that PHP has taken quite a leap since the older version. I follow from the book and when what I'm doing doesn't work, I look in kevins source in the code database and his code has differences from his instructions in the book. For example

    on chapter 3 page 42 , last line second paragraph it says "In the body of this new file, type:

    <?php
    echo( "Welcome to our Web Site, $name!");
    ?>

    But his source code in the code library says:

    <?php
    $name = $_GET['name'];
    echo( "welcome to our Web Site, $name!");
    ?>

    ...No where in the book does it explain the syntax $name = $GET['name'];
    (which seems obviously important). My script (seemingly enough) therefor didn't work when doing it the first way. Which means that either there is more than one way to do it and my server doesn't support it somehow, or that PHP, since the publishing of this book, has changed and Kevin explains it in the new version of his book. (I would hope he doesn't leave anything like this out).

    My friend offered to buy the new book for me for $20.00 him purchasing the new version a few months before the new one came out, and was offered the new book for $20.00 from sitepoint. So he offered for me to by both from him for a grand total of $40.00. Taking a small loss (seeing as he never used the book and went coldfusion) but giving me a break.

    So my question is, should I do it? Does the new version really cover the things like $GET['name']; and all that jazz. I'm at a halt, because I don't want to learn old code that won't work. The download of the first 4 chapters seems to be the same version I have... Please help!!

  2. #2
    SitePoint Addict
    Join Date
    Nov 2002
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Old book used global variables. This practice has since been discouraged. Therefore, you now need to define your variables, hence: $name = $_GET['name'];

  3. #3
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    Greenville, SC
    Posts
    388
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is all this explained in kevins new book?

  4. #4
    SitePoint Guru
    Join Date
    Jun 2001
    Location
    Australia
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im a little confussed on that globals too. I'v read a few articles here but I can't grab the idea of it in practice.

  5. #5
    No. Phil.Roberts's Avatar
    Join Date
    May 2001
    Location
    Nottingham, UK
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •