Jump to content


Photo

Code Coming up with error


  • Please log in to reply
4 replies to this topic

#1 usadarts

usadarts
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts
  • LocationLaurence Harbor, NJ

Posted 19 April 2006 - 05:08 PM

Hello all,

    
 if($row['approved']= "Y"){
    $sanctioned = "<img src="/pictures/approved.jpg">"
    }

Receiving the following error:

Parse error: parse error, unexpected T_STRING in public_html/tournaments/calendar/test2.php on line 70


Thanks,
David

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 19 April 2006 - 05:11 PM

You must escape the double quotes in the string:
    
 if($row['approved']= "Y"){
    $sanctioned = "<img src=\"/pictures/approved.jpg\">"
    }
Or use this single quotes:
    
 if($row['approved']= "Y"){
    $sanctioned = '<img src="/pictures/approved.jpg">'
    }

~ D Kuang

#3 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 19 April 2006 - 05:11 PM

Thats because you used inside the double quotes, double quotes.
This should work:
if($row['approved']= "Y"){
    $sanctioned = '<img src="/pictures/approved.jpg">'
    }
Orio.

EDIT- hehe poirot you are faster :D
Think you're smarty?

(Gone until 20 to November)

#4 usadarts

usadarts
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts
  • LocationLaurence Harbor, NJ

Posted 19 April 2006 - 05:17 PM

Changed code to:
    
    if($row['approved']= "Y"){
    $adosanctioned = '<img src="/pictures/approved.jpg">'
    }


Now getting this error:
Parse error: parse error, unexpected '}' in /public_html/tournaments/calendar/test2.php on line 71

#5 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 19 April 2006 - 05:24 PM

You forgot the terminating semi-colon on this line:
<?php $adosanctioned = '<img src="http://www.adodarts.com/pictures/approved.jpg">' ?>

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users