SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Feb 2000
    Location
    xyz
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a PHP script I made to show a MySQL record:


    <?

    // connect to our database
    require("includes/includes.inc");

    if (isset($rID)):

    // SHOW ARTICLE

    $result = mysql_query("SELECT * FROM reviews WHERE rID = $rID");
    if (!$result) {
    echo("<p>Houston, we have a problem. Error: " . mysql_error() . "</P>");
    exit();
    }
    $row = mysql_fetch_array($result); ?>
    <HTML>
    <HEAD>
    <TITLE>Adventure Gamer - Reviews - <? echo "$row["title"]" ?></TITLE>
    </HEAD>
    <BODY>
    <b><? echo "$row["title"]" ?></b><br>
    <? echo "$row["title"]" ?><br>
    <h1><? echo "$row["title"]" ?></H1><br>
    </BODY>
    </HTML>

    I am getting the error "Parse error: parse error, expecting `STRING' or `NUM_STRING' or `'$'' in /home/qgamer/questgamer-www/reviews.php on line 18"

    Line 18 is the one with the <TITLE> tag. I went through the script over and over again but couldn't find any slip ups. Does anyone see a bug?

  2. #2
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi
    this is not the answer to the parse problem you have but i always get an error with this line of code.

    require("includes/includes.inc");

    what my server wants is

    require("/includes/includes.inc");

    hope this helps.

    ed



  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it is the use of two sets of double quotes try using <? print $row["title"] ?> Since its a vraible you wont need the outer quotes when using print

  4. #4
    SitePoint Zealot
    Join Date
    Feb 2000
    Location
    xyz
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That did the trick

    If you use PHP files in subdirectories, it is best to include the / slash in the includes.inc address. It works fine if all your PHP files are in the root though


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
  •