![](/img/trans.png)
[英]How to insert multiple data of same name from single form in multiple row of same column of table
[英]How to retrieve data from multiple table having same column name
我需要幫助。 我很清楚(Google / stackoverflow)上也有類似的問題,我從中獲得了很多信息,這有助於我前進,但是我被困在某個地方,我想寫“ where”聲明。好像我沒明白沒錯,這就是這篇文章的原因。
我需要從具有相同列名的許多表中獲取數據。 請在下面是我到目前為止編寫的代碼。
$result = $connection->query("select price.ID as id1, price.ID as id2 from tbladventure, tblafrica where price>='$pricefrom' and price <='$priceto'");
for ($i = 0;$i<$result->num_rows;$i++){
$row = $result->fetch_array(MYSQLI_NUM);
echo $row['id1']."<br>";
echo $row['id2']."<br>";
}
以下是Web界面
在where條件下使用tablename.columnname
$result = $connection->query("select price.ID as id1, price.ID as id2 from tbladventure, tblafrica where tbladventure.price>=".$pricefrom." and tblafrica.price <=".$priceto);
select price.ID as id1, price.ID as id2 from tbladventure, tblafrica where price>='$pricefrom' and price<='$priceto'
您選擇的第一個ID應該來自“價格”表。 第二個ID應該來自表格“價格”。 問:為什么要這么做?
然后,您使用“ tbladventure”和“ tblafrica”,但從這些表中不選擇任何行。
您的要求似乎非常糟糕:您到底需要做什么?
請求返回什么? 任何錯誤信息?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.