Parse error: syntax error, unexpected T_DNUMBER

May 8th, 2007

I was working on a site for someone trying to find out why the page was displaying this error ‘Parse error: syntax error, unexpected T_DNUMBER’.

After looking up a number of different references on Google and still not finding an answer that would point to an easy solution, I spent an hour going through line by line of code trying to find the problem.

Finally, I found that the eval() function for PHP was trying to display a template with variables but was generating this error and stop the page from displaying.

So I found that the problem lied in a variable that was being set had a ton of html in it and there were two quotation marks that were not being escaped.

Here is the problem code:

<DIV CLASS=googleadsovergame>
<script language=\"JavaScript\">
<!--
ctxt_ad_partner = "9999999999";
ctxt_ad_section = "99999";

Here is the fixed code:

<DIV CLASS=googleadsovergame>
<script language=\"JavaScript\">
<!--
ctxt_ad_partner = \"9999999999\";
ctxt_ad_section = \"99999\";

It was a simple fix really, but a problem that I have found is that there were no comments in the code to make it easy to find my way through the number of pages and functions until I got to the problem.

I hope that this helps you find your problem with this error!

So remember, comment your code as much as possible, those who come after you will thank you for it!

3 Comments

  1. Comment by Haejin on November 28, 2007 2:01 am

    I got the same error but solved very quickly thanks to your posting.

    Thank you so much!!

  2. Comment by NS on April 13, 2008 8:04 am

    Thanks man, you saved me a lot of time! :)

  3. Comment by sushant mehta on September 15, 2008 8:36 am

    hey thanks a lot!!
    was getting the same error….fixed with your help :)
    Thanks

Comments RSS TrackBack Identifier URI

Leave a comment

  • Syndicate

    • Subscribe in NewsGator Online
    • Add to Google
    • Subscribe in Bloglines
    • Subscribe in FeedLounge
    • Add to netvibes
    • Add to My AOL
    • Subscribe in Rojo