我创建了一个带有嵌套 select 语句的 mysql seect 语句。现在我的 mysql 技能(或缺乏)非常有限。下面是我写的代码。我得到空白结果或警告。mysql_fetch_Array 错误。现在我收到一个错误,上面写着“子查询返回超过 1 行”任何人都可以指出我如何开始解决这个问题的正确方向。谢谢您的帮助。
<?php
session_start();
$memberId = $_GET['id'];
$loggedId = $_SESSION['id'];
include('../connect_DB.php');
$sql = 'SELECT bins.tag_Id, tagging_Info.plant_Id, tagging_Info.photo_Id FROM bins inner join tagging_Info on bins.tag_Id = tagging_Info.tag_Id inner join collections on collections.id = bins.collection_Id WHERE collections.member_Id ='.$memberId.' and collections.id=(SELECT id FROM collections where member_Id='.$memberId.')';
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
$collection = "Success"; // test to see if working
}
echo $collection;
?>