Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

[Resolved] Parse error: Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
I have run script below, and had no error... (??)
PHP:
<?php
echo nl2br("\n\n<a href='" . $_SERVER['SCRIPT_NAME'] . "'>Back</a>");
?>
 
0
Close
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
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back