「カートに入れる」のように、静的テーブルの後にデータを表示したい。検索データであり、静的テーブルで表示することを選択します。 like to add cartカートに入れる
<table>
<th>Item</th> <th>Description</th>
<tr>
<td>Monitor<td>
<td>Monitor Blue<td>
</tr>
<tr>
<td>Mouse<td>
<td>Mouse Wireless<td>
</tr>
<tr>
<td>Keyboard<td>
<td>Keyboard<td>
</tr>
私の検索フォーム:これは問題ではありません。すべての行の追加ボタンでのみ。したがって、アイテムを検索するときに、静的テーブルに追加する場合は選択肢があります。
検索:
Mysqlの検索
<?
$sql = "select * from item_tb where name='".$search."'";
$result=$conn->query($sql);
echo "
<table cellspacing='20' border='0' ><tr> <th>Item</th><th>Description</th>
</tr>";
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "
<tr> <td>
".$row["name"]."</td> <td>
".$row["description"]."</td>";
echo" <form name='add' method='POST'>";
echo" <td><a href='item.php?id=".$row['Iid']."'><input type='submit' value='Add'></td></a>";
echo" </form>";
}
}
?>
はここに私の主な問題です。私は検索するデータを取得するテーブルを作成する方法はありませんし、アイテムiが追加する数だけ表示されます。私は本当にこれでダウンしています。
<?
if($id != "")
{
$sql = "SELECT * FROM item_tb WHERE Iid='".$id."'";
$result=$conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo" ".$row["name"]." ";
}
}
}
?>
あなたの質問の説明が混乱して、あなたはそれはあなたのコードの話を伴うことなく、簡単な言葉で言うことができます? –
@ UmairShahYousafzai、そこに行きます。私はあなたが混乱させる場合、ごめんなさい – noOne
それはどういう意味ですか? –