0
私の動的表の中の情報を誰かがクリックしたときに取得しようとしているので、列単位で読み込んでデータを抽出して表示することができますテキストボックスに保存します。私はこの言語に新しいので、それを行う方法を知らない、あなたが助けることを願っています。現時点で何をしているのかは、私のデータベースからデータを取り出し、それを使って動的テーブルを作成することです。 私はすでにいくつかのことを試みましたが、どれもうまくいきませんでしたので、失敗したすべての試行をここに貼り付けるつもりはありません。多くの人々はそれがmysqlの私がMysqli_にそれを更新しているとの問題を抱えていたので、 はこれが(私のコードです:PHPでhtml行(テーブル内)からデータを取得するには
if (($result)||(mysqli_errno == 0))
{
echo "<table cellspacing='0' cellpadding='0' border='0' width='126%'>
<tr>
<td>
</table>
<div style='width:450; height:350px; overflow:auto;'>
<table cellspacing='0' cellpadding='1' border='1' width='380px'>
<tr style='color:white;background-colorgrey'>";
if (mysqli_num_rows($result)>0)
{
//loop thru the field names to print the correct headers
$i = 0;
while ($i < mysqli_num_fields($result))
{
$fetch = mysqli_fetch_field_direct($result, $i);
echo "<th>". $fetch->name . "</th>";
$i++;
}
//display the data
while ($rows = mysqli_fetch_assoc($result))
{
echo "<tr>";
foreach ($rows as $data)
{
echo "<td align='center' width='400px'>". $data . "</td>";
}
echo"</tr>";
}
}else{
echo "<tr><td colspan='" . ($i+1) . "'>No Results found!</td></tr>";
}
echo "</table></div>";
この行の終了タグは次のとおりです。
出力がありますか?BTW:mysql_ *は既に廃止されていますが、代わりにmysqli_ *を使用してください! – Bernhard
trを閉じるのを忘れてしまいました!^^ @Virb – JuanjoC
答えて
答えに興味がある人のために、私は、要素(変数「ID」の店舗をそれを考え出しました
出典
2017-07-28 10:47:21 JuanjoC
関連する問題