FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Parse error: syntax error, unexpected '$sql' (T_VARIABLE) in
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
PHP Parse error: syntax error, unexpected '$sql' (T_VARIABLE) in [message #185583] Wed, 16 April 2014 21:22 Go to next message
Very Grateful is currently offline  Very Grateful
Messages: 1
Registered: April 2014
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Hello kind coders. Basic PHP error I think. Any thought on this?


I'm getting this error on a lot of the pages on my site:

Parse error: syntax error, unexpected '$sql' (T_VARIABLE) in
/home/company/public_html/pages/job-postings/index.php on line 7

this is the snippet of code i think the above error message refers to:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?
include_once '../../cms/assets/includes/config.inc';d
$sql = "SELECT * FROM cms_pages WHERE page_name='$PHP_SELF'";
$result = mysql_query($sql);
$page = mysql_fetch_array($result);

?>

<title><? echo $page[page_title]; ?></title>


Thanks for reading and considering

--
Re: PHP Parse error: syntax error, unexpected '$sql' (T_VARIABLE) in [message #185584 is a reply to message #185583] Wed, 16 April 2014 21:36 Go to previous message
Lew Pitcher is currently offline  Lew Pitcher
Messages: 60
Registered: April 2013
Karma: 0
Member
add to buddy list
ignore all messages by this user
On Wednesday 16 April 2014 21:22, in comp.lang.php, "Very Grateful"
<91eed282a561b153be6ebcb2238f5a4e_6720(at)example(dot)com> wrote:

> Hello kind coders. Basic PHP error I think. Any thought on this?
>
>
> I'm getting this error on a lot of the pages on my site:
>
> Parse error: syntax error, unexpected '$sql' (T_VARIABLE) in
> /home/company/public_html/pages/job-postings/index.php on line 7
>
> this is the snippet of code i think the above error message refers to:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <?
> include_once '../../cms/assets/includes/config.inc';d

You have a character 'd' following the end-of-statement marker ';'
PHP reads this 'd' as the start of the next statement, which continues with
the $sql of the statement below

> $sql = "SELECT * FROM cms_pages WHERE page_name='$PHP_SELF'";

Taken together
d $sql = "SELECT * FROM cms_pages WHERE page_name='$PHP_SELF'";

is a syntax error. PHP was not expecting a variable ($sql) to follow the 'd'
token, and told you so.

To fix it, remove the 'd' from after the semi-colon on the include_once line

> $result = mysql_query($sql);
> $page = mysql_fetch_array($result);
>
> ?>
>
> <title><? echo $page[page_title]; ?></title>
>
>
> Thanks for reading and considering
>


--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Heartbleed bug?
Next Topic: select date from DATETIME field
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Dec 12 05:24:39 EST 2017

Total time taken to generate the page: 0.00691 seconds