SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2002
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Kevin's book chapter 6

    I'm totally new to the world of mysql / php, but I've been following kevin's book in detail. I've downloaded his code, but I can't seem to get chapter 6 working -- and this is the most important chapter. If I start with admin.html, and click on jokes.php, I get the correct output for manage jokes - the php seems to be working. But if I click on newjoke.php, the php seems to stop - I get the following:

    You must choose an author " . "for this joke. Click 'Back' " . "and try again.

    "); exit(); } $dbcnx = mysql_connect("localhost", "root"); mysql_select_db("jokes"); $sql = "INSERT INTO Jokes SET JokeText='$joketext', JokeDate=CURDATE(), AID='$aid'"; if (@mysql_query($sql)) { echo("
    New joke added .......(I think you get the idea)
    It's as if the php has stopped and only the html is working. Any clues what I'm doing wrong or where I can turn for help?

  2. #2
    Wibblesticks Gryff's Avatar
    Join Date
    Oct 2001
    Location
    Asgard
    Posts
    442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    imho another register_globals error
    you can no longer just start using a variable that has been post/get'd.
    You have to use
    $_POST["varname"];
    $_GET["varname"];
    depending on which your using to get access to the variable.
    It also seems as if its started printing the php to the browser
    did you forget to restart a <? to resume parsing the php?
    ( guessing cuz I didnt use kevs books )

  3. #3
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Gryff
    imho another register_globals error
    yup.

    it's just a shame that his book is teaching the wrong way to people who are trying to learn. and then it's frustrating when the code doesn't work...

    i should write a book.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  4. #4
    SitePoint Addict TegSkywalker's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The PHP team turned them off by default with 4.2.0. Not sure if that is the issue, but be sure to check up with your server admin.


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
  •