for some reason the below code is outputting the correct ticker in the location of LPrice for all items, but only outputting the correct data for the second data element for PCT and PNL. Meaning, row 1 output only populating in one section, while row 2 populating in all correct sections. Note: there are currently only 2 elements in the table.
<?php
$host="localhost"; // Host name
$username="abc"; // Mysql username
$password="password"; // Mysql password
$db_name="abc"; // Database name
$tbl_name="portfolio"; // Table name
$conn=mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="select * from ".$tbl_name.";";
$result = mysql_query($sql) or die(mysql_error());
echo '<table class="tickerContain">';
echo '<tr>';
echo '<td>ID</td>';
echo '<td>TICKER</td>';
echo '<td>PRICE</td>';
echo '<td>CommIn</td>';
echo '<td>CommOut</td>';
echo '<td>DateIn</td>';
echo '<td>LPrice</td>';
echo '<td>%CHG</td>';
echo '<td>PNL</td>';
$tblOut='';
while ($row = mysql_fetch_array($result))
{
$tick='';
$tick=$row["ticker"];
$tblOut.= '<tr>';
$tblOut.= '<td id="'.$tick.'id">' . $row["id"] . '</td>';
$tblOut.= '<td id="'.$tick.'ticker">' . $tick . '</td>';
$tblOut.= '<td id="'.$tick.'price">' . $row["price"] . '</td>';
$tblOut.= '<td id="'.$tick.'commissionIn">' . $row["commissionIn"] . '</td>';
$tblOut.= '<td id="'.$tick.'commissionOut">' . $row["commissionOut"] . '</td>';
$tblOut.= '<td id="'.$tick.'dateIn">' . $row["dateIn"] . '</td>';
$tblOut.= '<td><textarea class="realTime" id="'.$tick.'LPrice">'.$tick.'</textarea></td>';
$tblOut.= '<td><textarea class="realTime" id="'.$tick.'pctChange">'.$tick.'</textarea></td>';
$tblOut.= '<td><textarea class="realTime" id="'.$tick.'pnl">'.$tick.'</textarea></td>';
$tblOut.= '</tr>';
}
echo $tblOut;
echo '</table>';
echo '</td>', '<td>'orecho '</td>' . '<td>'or (best of all)echo '</td><td>'. Whichever way you choose, stop doing what you're doing. It's painful.</tr>right before$tblOut='';$tick='';at the top of the loop doesn't accomplish anything as you immediately assign$row['ticker']to it on the next line. 2) There's no reason to build your table contents inside$tblOut, just echo the contents directly. 3) None of your output is being escaped; this could be why some of it isn't appearing properly