Jump to content

Archived

This topic is now archived and is closed to further replies.

usadarts

Code Coming up with error

Recommended Posts

Hello all,

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

Receiving the following error:

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


Thanks,
David

Share this post


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

Share this post


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

EDIT- hehe poirot you are faster :D

Share this post


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


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

Share this post


Link to post
Share on other sites
You forgot the terminating semi-colon on this line:
[code]<?php $adosanctioned = '<img src="http://www.adodarts.com/pictures/approved.jpg">' ?>[/code]

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.