Hertus Hertus - 4 years ago 112
PHP Question

mysqli css "td class"

I want to style the following mysqli output:

while($row = mysqli_fetch_array($result)) {
$date = $row['name'];
$comment = $row['id'];
$amount = $row['icon'];
echo
"<tr><td style='width: 600px;'>".$date."</td></tr>
<tr><td style='width: 600px;'>".$comment."</td></tr>
<tr><td>".$amount."</td>
</tr>";
}

echo "</table>";


I want to use for the
<td style='width: 600px;'>
a css class. If I use the following code, my mysql data disappears. Why?

<tr><td class="links">".$date."</td></tr>

Answer Source

What about, or am I saying something weird .. ?

<tr><td class='links'>".$date."</td></tr>

You need to escape the "", so it won't be interpreted as end of te echo. Use can also use \ to escape it. My way just solves it by switching the "" from links to ''.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download