views:

36

answers:

4

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 some how.

please help

+2  A: 

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 (.).

Sarfraz
I think he was trying to make it **bold** although it isn't possible inside code :-)
acmatos
+2  A: 

You're just missing a closing parenthesis:

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

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>";
Lucanos
+1  A: 

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!

bblincoe