Jump to content

[SOLVED] T_VARIABLE


seeya

Recommended Posts

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  ;D

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.