seeya Posted January 26, 2008 Share Posted January 26, 2008 could someone help me with below code as i get the following error msg: Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' <?php if (trim($row['sCategory']) =="Bra") echo "Available Cup Size:" $row['sPcup'] "<br>"; else echo ""; ?> thanks Quote Link to comment https://forums.phpfreaks.com/topic/87893-solved-t_variable/ Share on other sites More sharing options...
beansandsausages Posted January 26, 2008 Share Posted January 26, 2008 sould be : <?php if(trim($row['sCategory']) =="Bra") { echo "Available Cup Size:" $row['sPcup'] "<br>"; } else { echo ""; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/87893-solved-t_variable/#findComment-449704 Share on other sites More sharing options...
seeya Posted January 26, 2008 Author Share Posted January 26, 2008 it still show the error code. it is pointing on the line echo "Available Cup Size:" $row['sPcup'] "<br>"; } Quote Link to comment https://forums.phpfreaks.com/topic/87893-solved-t_variable/#findComment-449708 Share on other sites More sharing options...
kenrbnsn Posted January 26, 2008 Share Posted January 26, 2008 No, the braces are optional when there is only one line in the conditional block, the problem is that the OP isn't using the concatenation operator in the echo statement: <?php if (trim($row['sCategory']) =="Bra") echo "Available Cup Size:" . $row['sPcup'] . "<br>"; else echo ""; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/87893-solved-t_variable/#findComment-449710 Share on other sites More sharing options...
beansandsausages Posted January 26, 2008 Share Posted January 26, 2008 yea i just read the code propely sorry my bad didnt read all of it Quote Link to comment https://forums.phpfreaks.com/topic/87893-solved-t_variable/#findComment-449711 Share on other sites More sharing options...
seeya Posted January 26, 2008 Author Share Posted January 26, 2008 thanks kenrbnsn. so sorry, i just update the code that kenrbnsn gave me and now i am thrown with this error. Parse error: parse error, unexpected '<' <?php if (trim($row['sCategory']) =="Bra") echo "<b><font color=#3333ff face=Verdana size=2>Available Cup Size: " . <font face=Verdana size=2 color=brown>$row['sPcup'] . </font></font> "<br>"; else echo ""; ?>code] Quote Link to comment https://forums.phpfreaks.com/topic/87893-solved-t_variable/#findComment-449716 Share on other sites More sharing options...
kenrbnsn Posted January 26, 2008 Share Posted January 26, 2008 You need to quote strings. <?php if (trim($row['sCategory']) =="Bra") echo "<b><font color=#3333ff face=Verdana size=2>Available Cup Size:<font face=Verdana size=2 color=brown>" . $row['sPcup'] . "</font></font> <br>"; else echo ""; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/87893-solved-t_variable/#findComment-449724 Share on other sites More sharing options...
seeya Posted January 26, 2008 Author Share Posted January 26, 2008 it works very well. thank u so much!! Quote Link to comment https://forums.phpfreaks.com/topic/87893-solved-t_variable/#findComment-449784 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.