ECHO MYSQL结果显示空白页[关闭]
问题描述:
I know it must be something simple but I can't do
I need display the text into a DIV
Like this:
<div>
<p><font color="#bdbdbd">TEXTO FROM MYSQL</font></p>
</div>
My table structure is:
id int(11) Nulo: Não Padrão:Nenhum AUTO_INCREMENT
depoimento varchar(255) utf8_unicode_c… NULL
client varchar(60) utf8_unicode_ci Nulo:Sim Pa… NULL
You can see my code in action here: loja.genesiseries/depoimentos/testemysql.html
$sql = "SELECT * FROM opinions ORDER BY id DESC LIMIT 15";
$resultado = mysql_query($sql);
while ($linha=mysql_fetch_array($resultado)) {
$depoimento = $linha["depoimento"];
$client = $linha["client"];
echo "$depoimento";
echo "$client";
}
?>
But it still appearing in blank I'm using a SEMI DEDICATED SERVER (VPS)
Any idea?
Thanks!
答
Rename loja.genesiseries/depoimentos/testemysql.html
to loja.genesiseries/depoimentos/testemysql.php
<div>
<p>
<font color="#bdbdbd">
<?php
$sql = "SELECT * FROM opinions ORDER BY id DESC LIMIT 15";
$resultado = mysql_query($sql);
while ($linha=mysql_fetch_array($resultado)) {
$depoimento = $linha["depoimento"];
$client = $linha["client"];
echo "$depoimento";
echo "$client";
}
?>
</font>
</p>
</div>