Forum Moderators: coopster
I'm a newbie and I have a quick question about formatting HTML and PHP. I'm reading data from a database and the code is as follows:
// Fetch each of the query rows
while ($row = @ odbc_fetch_array($result))
{
// Print one row of results
echo "\n<tr>\n\t<td>{$row["TOPIC"]}</td>";
echo "\n\t<td>{$row["MEANDEPTH"]}</td>";
echo "\n\t<td>{$row["VARIANCE"]}</td>";
echo "\n\t<td>{$row["BATTERY"]}</td>";
} // end while loop body
However, I wish to format the data collected from VARIANCE column with the substr() function. I've tried numerous ways of doing this but nothing is working. I'm pretty sure it's all to do with the formating of various tags. The obvious (to me atleast) way to go about doing this would be:
echo "\n\t<td>substr({$row["VARIANCE"]},3)</td>";
Could someone help me with this? I know this is pretty trival but there's surprisingly not much info on how to go about doing this. Thanks again!
James