Parse error: syntax error, unexpected T_LNUMBER

could you please help about this error message

Page 1 of 1

8 Replies - 13666 Views - Last Post: 07 January 2009 - 12:43 PM Rate Topic: -----

#1 Ghost rider  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 158
  • Joined: 29-October 08

Parse error: syntax error, unexpected T_LNUMBER

Posted 05 January 2009 - 11:16 AM

I'm trying to control the size of image using this line of code.

 echo "<img src=\"images/". $row['name'] . "\" alt=\"\" height="150" width="234" /> <br /></td></tr>";


when use this tag to control size of images
height="150" width="234"


it displaying this error message and line31 is that first line of code above.

Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in C:\wamp\www\upload\images1.php on line 31.

Is This A Good Question/Topic? 0
  • +

Replies To: Parse error: syntax error, unexpected T_LNUMBER

#2 Hary  Icon User is offline

  • D.I.C Regular

Reputation: 44
  • View blog
  • Posts: 427
  • Joined: 23-September 08

Re: Parse error: syntax error, unexpected T_LNUMBER

Posted 05 January 2009 - 11:21 AM

You forget to escape the " around the size thingies. You do escape the first one, escape the rest as well!

This post has been edited by Hary: 05 January 2009 - 11:22 AM

Was This Post Helpful? 0
  • +
  • -

#3 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Re: Parse error: syntax error, unexpected T_LNUMBER

Posted 05 January 2009 - 11:31 AM

Try this it does the same
 echo "<img src='images/ $row[name]' alt='\' height='150' width='234' /> <br /></td></tr>";


Was This Post Helpful? 0
  • +
  • -

#4 Ghost rider  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 158
  • Joined: 29-October 08

Re: Parse error: syntax error, unexpected T_LNUMBER

Posted 05 January 2009 - 11:46 AM

Thank for your reply. I tried use escape in all position around size thingies but I still getting the same error. Please could you illustrate using code? Thanks in advance
Was This Post Helpful? 0
  • +
  • -

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6107
  • View blog
  • Posts: 23,661
  • Joined: 23-August 08

Re: Parse error: syntax error, unexpected T_LNUMBER

Posted 05 January 2009 - 12:08 PM

Show us the most recent thing you tried.
Was This Post Helpful? 0
  • +
  • -

#6 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3099
  • View blog
  • Posts: 10,888
  • Joined: 08-August 08

Re: Parse error: syntax error, unexpected T_LNUMBER

Posted 05 January 2009 - 12:21 PM

View Postsam_benne, on 5 Jan, 2009 - 10:31 AM, said:

Try this it does the same
 echo "<img src='images/ $row[name]' alt='\' height='150' width='234' /> <br /></td></tr>";


I think you meant:
 echo "<img src='images/ $row[name]' alt='' height='150' width='234' /> <br /></td></tr>";


Was This Post Helpful? 0
  • +
  • -

#7 Hary  Icon User is offline

  • D.I.C Regular

Reputation: 44
  • View blog
  • Posts: 427
  • Joined: 23-September 08

Re: Parse error: syntax error, unexpected T_LNUMBER

Posted 05 January 2009 - 12:23 PM

Or better (without inline vars, other coding style):

 echo "<img src=\"images/". $row['name'] . "\" alt=\"\" height=\"150\" width=\"234\" /> <br /></td></tr>";


If this does not work, post the exact code you are using, and the new error.

This post has been edited by Hary: 05 January 2009 - 12:24 PM

Was This Post Helpful? 0
  • +
  • -

#8 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Parse error: syntax error, unexpected T_LNUMBER

Posted 05 January 2009 - 01:22 PM

Modified title to be more descriptive of the problem.
Was This Post Helpful? 0
  • +
  • -

#9 bastones  Icon User is offline

  • New D.I.C Head

Reputation: 5
  • View blog
  • Posts: 35
  • Joined: 03-January 09

Re: Parse error: syntax error, unexpected T_LNUMBER

Posted 07 January 2009 - 12:43 PM

Your problem is with the quotations you have with your height and width sections - because you're still echoing text/HTML, so you aren't \"escaping\" from the point of the height and width bit.

This should fix your problem:

echo "<img src=\"images/". $row['name'] . "\" alt=\"\" height=\"150\" width=\"234\" /> <br /></td></tr>";


Edit: I've just noticed Hary has provided the same code but before anyone complains about it I have also explained the problem too ...

This post has been edited by bastones: 07 January 2009 - 12:47 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1