Reputation: 9
Code looks fine, but it is not retrieving the "GroupMembers". Help?
<?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
Upvotes: 1
Views: 67
Reputation: 5004
change this: GroupID=$GetGroupByID->ID to this: GroupID='{$GetGroupByID->ID}'
Upvotes: 2
Reputation: 45
Is your $ID a numeric parameter ? If yes then try this code
$GetGroupByID = mysqli_fetch_object(mysqli_query($db, "SELECT * FROM Groups WHERE ID=$ID"));
Upvotes: 0
Reputation: 119
Try it like this and see if it works:
$GetGroupByID = mysqli_fetch_object(mysqli_query($db, "SELECT * FROM Groups WHERE ID=$ID"));
Upvotes: 0