I have records in my database but I can't display them. Can someone check my codes, please. I'm just an amateur web developer. Thanks for any help.
$groups=mysql_query("SELECT * FROM groups ORDER BY id ASC");
$members=mysql_query("SELECT * FROM members WHERE group='$g_id'");
echo "<tr><td colspan=2>Nothing to display</td></tr>";
echo "<tr><td colspan=2>Error</td></tr>";
You need to escape reserved words in MySQL like
group with backticks
SELECT * FROM members WHERE `group` = '$g_id' ^-----^-------------here
You can also spare the inner loop when you join your data like this
select g.id as gid, g.g_name, m.id as mid, m.m_name, m.m_email from groups g inner join members m on g.id = m.group order by g.id asc
This is easier and will increase performance since you don't need to execute a lot of queries but just one.
Also please don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. Learn about Prepared Statements instead, and use PDO or MySQLi. See this article for a quick overview how to do it and why it is so important.