当我在链接到 test.php 的 HTML 文件中使用 iframe 时,结果是好的
测试.php:
<?php
$host = "localhost";
$user = "user";
$pass = "pass";
$database = "db";
$koneksi = mysql_connect ($host,$user,$pass);
mysql_select_db($database,$koneksi) or die ("error");
$result = mysql_query("SELECT * FROM pengumuman");
$i = 0;
while($row = mysql_fetch_array($result)) {
echo "<li><a href='#'>".$row['judul']."</a></li>";
$i++;
}
mysql_close($koneksi);
?>
但我确实想分离这个 test.php,所以我把它混合在我的 HTML 文件中
<?php
$host = "localhost";
$user = "user";
$pass = "pass";
$database = "db";
$koneksi = mysql_connect ($host,$user,$pass);
mysql_select_db($database,$koneksi) or die ("error");
$result = mysql_query("SELECT * FROM pengumuman");
$i = 0;
while($row = mysql_fetch_array($result)) {
?>
<li><a href='#'><?php $row['judul'] ?> </a></li>
<?php
$i++;
}
mysql_close($koneksi);
?>
结果又不行了!真的,我是 web prog 的新手 .. 任何人都可以帮助我吗?