2011-03-17 124 views
-1

我在我的數據庫(probe_config)中有一個表(webmeasurementsuite)。我寫了一個php編碼從數據庫檢索數據並將其顯示在html表中。糾正我的錯誤please.when我加載到瀏覽器的PHP頁面,我得到一個空白頁。 $ conn = mysql_connect(「localhost」,「root」,「mysql」);
if(!$ con)
{
die('Could not connect:'。mysql_error());
}在單個html表中檢索兩個數據庫表值

mysql_select_db(「my_db」,$ con);

$ result = mysql_query(「SELECT * FROM webmeasurementsuite」);

回聲「<table border='1'>

<tr>
<th>複製</th>
<th>等待</th>
<th>超時</th>
<th> clearcache </th>
<th></th>
<th> wms </th>
</tr>;

而($行= mysql_fetch_array($結果))
{
回聲 「<tr>」;
echo「<td>」。 $ row ['replication']。 「</td>」;
echo「<td>」。 $ row ['wait']。 「</td>」;
echo「<td>」。 $ row ['timeout']。 「</td>」;
echo「<td>」。 $ row ['clearcache']。 「</td>」;
echo「<td>」。 $ row ['name']。 「</td>」;
echo「<td>」。 $ row ['wms']。 「</td>」;
echo「</tr>」;
}
echo「</table>」;

mysql_close($ con);
?>

+1

你需要更加精確。請讓它更容易幫助你。將代碼粘貼到此處,並明確告訴我們您遇到的問題。否則它將被關閉爲'不是問題' – 2011-03-17 07:22:58

+0

如果有其他問題需要回答這個問題,請讓我知道 – 2011-03-17 08:59:47

回答

0

我想你需要了解更多關於Web Development

HTML僅用於呈現適當格式的信息。爲了訪問數據庫記錄,我們必須使用服務器端Scripting Languages或Web技術(J2EE,JSPASP等)來訪問數據庫。這不能單用HTML完成。

如果錯了,請多介紹一下您的問題。