开发者

php function output in a table row... how?

I want to run this function but show the result in a table row:

strlen($cat_row['sms']

This is what 开发者_运维知识库I came up with but it is not working:

echo  `"<tr><td bgcolor=#626E7A>".**strlen($cat_row['cars']**."</td></tr>";`

How do you show result of a php function in a table row? I am trying to format the output somehow.

Please help.


No need for **, try this instead:

echo "<tr><td bgcolor=#626E7A>" . strlen($cat_row['cars']) . "</td></tr>";

The concatenation operator in php is a dot (.).


You're just missing a closing parenthesis:

echo '<tr><td bgcolor="#626E7A">' . strlen($cat_row['cars']) . '</td></tr>';


It should work, but you have to make sure that you close the brackets for the function:

Your code:

echo "<tr><td bgcolor=#626E7A>".strlen($cat_row['cars']."</td></tr>";

Corrected code:

echo "<tr><td bgcolor=#626E7A>".strlen( $cat_row['cars'] )."</td></tr>";


This is a simple problem with a simple solution:

<tr><td bgcolor=#626E7A><?php echo strlen($cat_row['cars']; ?></td></tr>

Hopefully that will work for you!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜