SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Parsing Error

  1. #1
    SitePoint Member
    Join Date
    Dec 2001
    Location
    Coalbrookdale, Telford, UK
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Parsing Error

    I am following the Kevin Yank series of articles through, and have entered the jokelist.php script that keeps giving me a parsing error in line 25

    The line pointed at is:-

    $result = @mysql_query("SELECT JokeText FROM Jokes");

    Can anyone tell me what is wrong with this please?

    If I open the Jokes database with MySQL direct the database produces the goodies OK.

    Thanks for your help.

  2. #2
    Probably eating pie mitsubishi's Avatar
    Join Date
    Sep 2001
    Location
    England, UK
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's the lines above?

  3. #3
    SitePoint Member
    Join Date
    Dec 2001
    Location
    Coalbrookdale, Telford, UK
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Whole file looks like this:-

    <html>
    <head>
    <title>Our List of Jokes</title>
    </head>
    <body>
    <?php
    // Connect to the database server
    $dbcnx = @mysql_connect("localhost", "root", "my_password");
    if (!$dbcnx) {
    echo( "<p>Unable to connect to the " .
    "database server at this time.</p>" );
    exit();
    }
    // Select the jokes database
    if (! @mysql_select_db("Jokes") ) {
    echo( "<p>Unable to locate the joke " .
    "database at this time.</p> );
    exit();
    }
    ?>
    <p> Here are all the jokes in our database: </p>
    <blockquote>
    <?php
    // Request the text of all the jokes
    $result = @mysql_query("SELECT JokeText FROM Jokes");
    if (!$result) {
    echo( "<p>Error performing query: " . mysql_error() . "</p> );
    exit();
    }
    // Display the text of each joke in a paragraph
    while ( $row = mysql_fetch_array($result) ) {
    echo( "<p> . $row["JokeText"] . "</p> );
    }
    ?>
    </blockquote>
    </body>
    </html>
    Last edited by stevecarter; Dec 21, 2001 at 17:29.

  4. #4
    SitePoint Member
    Join Date
    Aug 2000
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    stevecarter: As stupid as it sounds, if you post your SQL table dump it could help.
    I remember falling...
    i remember marching..
    like a one man army..


  5. #5
    Probably eating pie mitsubishi's Avatar
    Join Date
    Sep 2001
    Location
    England, UK
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a missing quote here
    PHP Code:
    // Select the jokes database 
    if (! @mysql_select_db("Jokes") ) { 
    echo( 
    "<p>Unable to locate the joke " 
    "database at this time.</p> ); 


    //with "

    // Select the jokes database 
    if (! @mysql_select_db("Jokes") ) { 
    echo( 
    "<p>Unable to locate the joke " 
    "database at this time.</p>" ); 
    The next quote is on line 25, which php thinks is the closing quote.


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
  •