Unstoppable Domains

[Resolved] Parse error: Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Spaceship Spaceship
Watch

flishess

Established Member
Impact
6
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

I am getting this error on line 24:

Code:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/getgscom/public_html/bf2matchplay/index.php on line 24

Code:
<?
include "config.php";

if (is_numeric($_GET['id']))
{
    $id = $_GET['id'];
    $result = mysql_query("SELECT platform,description,id,title,release_us,msrp,buylink,developer,publisher,esrb,genre,boxart FROM `gamepage` where id = $id") or die(mysql_error
        ());
    while ($row = mysql_fetch_array($result))
    {
        $title = $row["title"];
        $description = $row["description"];
        $cat = $row['platform'];
        $release_us = $row['release_us'];
        $boxart = $row['boxart'];
        $msrp = $row['msrp'];
        $buylink = $row['buylink'];
        $developer = $row['developer'];
        $publisher = $row['publisher'];
        $esrb = $row['esrb'];
        $genre = $row['genre'];
        echo nl2br($title . "\n\n" . $description . "\n\n" . $cat . "\n\n" . $release_us . "\n\n" . $boxart . "\n\n" . $msrp . "\n\n" . $buylink . "\n\n" . $developer . "\n\n" . $publisher . "\n\n" . $esrb . "\n\n" . $genre");
    }
    [COLOR=Red]LINE 24:[/COLOR] echo nl2br("\n\n<a href='" . $_SERVER['SCRIPT_NAME'] . "'>Back</a>");
} else
{

    $result = mysql_query("SELECT id,title FROM `gamepage`") or die(mysql_error());
    while ($row = mysql_fetch_array($result))
    {
        $title = $row["title"];
        $id = $row["id"];
        echo "<p><a href='index.php?id=$id'>$title</a></p>";
    }

}
?>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
I have run script below, and had no error... (??)
PHP:
<?php
echo nl2br("\n\n<a href='" . $_SERVER['SCRIPT_NAME'] . "'>Back</a>");
?>
 
0
•••
The error is not with line 24. As with most PHP errors you are best looking at the line before the 1 mentioned.

You have the following:-

PHP:
echo nl2br($title . "\n\n" . $description . "\n\n" . $cat . "\n\n" . $release_us . "\n\n" . $boxart . "\n\n" . $msrp . "\n\n" . $buylink . "\n\n" . $developer . "\n\n" . $publisher . "\n\n" . $esrb . "\n\n" . $genre");
    }

Notice near the end of the line you have a ". Remove this and the error will disappear.

I highly advise you to get an editor that checks your code as you write. For example I use Zend Studio. Spotting these types of errors are very easy. Without even running the script the IDE highlights that there is a problem with the line.

Take a look HERE as a demonstation.
 
Last edited:
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back