Mysqli SELECT *无效

时间:2015-07-26 23:31:17

标签: php mysqli

代码看起来很好,但它没有检索“GroupMembers”。帮助

<?php
        $ID = $db->real_escape_string(strip_tags(stripslashes($_GET["ID"])));
        $GetGroupByID = mysqli_fetch_object(mysqli_query($db, "SELECT * FROM Groups WHERE ID='$ID'"));

        $GetMembersTrunc = mysqli_query($db, "SELECT * FROM GroupMembers WHERE GroupID=$GetGroupByID->ID ORDER BY ID DESC LIMIT 0, 12") or die(mysqli_error());
?>

<?php while ($gMT = mysqli_fetch_object($GetMembersTrunc)): ?>
        ljlsdlfks
<?php endwhile; ?>

// shows no errors with "or die(mysqli_error());" and the text "ljlsdlfks" isn't appearing

// looks 100% fine to me

3 个答案:

答案 0 :(得分:2)

更改此信息:GroupID = $ GetGroupByID-&gt; ID 对此:GroupID ='{$ GetGroupByID-&gt; ID}'

答案 1 :(得分:0)

尝试这样,看看它是否有效:

$ GetGroupByID = mysqli_fetch_object(mysqli_query($ db,&#34; SELECT * FROM Groups WHERE ID = $ ID&#34;));

答案 2 :(得分:0)

您的$ ID是否为数字参数?如果是,请尝试此代码

devise_for :users 
devise_scope :user do
  scope '/admin' do
    get "/your_route" ...
  end
end