Mr. Confused
New member
I really need your help on this one.
I have made a small forum. All the messages are displayed in the main page which is (index.php) in a repeating region made in dreamweaver. All the messages are save in a MYSQL database in a table called (main). The recordset query is called (rs_messages).
Each message has a link to add a reply. All replies are saved in another table called (replies) and the link between them is (main.id) and (replies.msg_id). The recordset query is called (rs_replies).
What I want is to count how many replies for each message and display it in (index.php).
This is what I have done but it is not working:
===========================================================================
$colname_rs_replies = "-1";
if (isset($row_rs_messages['id'])) {
$colname_rs_replies = $row_rs_messages['id'];
}
mysql_select_db($database_mcr_db, $mcr_db);
$query_rs_replies = sprintf("SELECT * FROM replies, main WHERE msg_id = %s", GetSQLValueString($colname_rs_replies, "int"));
$rs_replies = mysql_query($query_rs_replies, $mcr_db) or die(mysql_error());
$row_rs_replies = mysql_fetch_assoc($rs_replies);
$totalRows_rs_replies = mysql_num_rows($rs_replies);
============================================================================
I have made a small forum. All the messages are displayed in the main page which is (index.php) in a repeating region made in dreamweaver. All the messages are save in a MYSQL database in a table called (main). The recordset query is called (rs_messages).
Each message has a link to add a reply. All replies are saved in another table called (replies) and the link between them is (main.id) and (replies.msg_id). The recordset query is called (rs_replies).
What I want is to count how many replies for each message and display it in (index.php).
This is what I have done but it is not working:
===========================================================================
$colname_rs_replies = "-1";
if (isset($row_rs_messages['id'])) {
$colname_rs_replies = $row_rs_messages['id'];
}
mysql_select_db($database_mcr_db, $mcr_db);
$query_rs_replies = sprintf("SELECT * FROM replies, main WHERE msg_id = %s", GetSQLValueString($colname_rs_replies, "int"));
$rs_replies = mysql_query($query_rs_replies, $mcr_db) or die(mysql_error());
$row_rs_replies = mysql_fetch_assoc($rs_replies);
$totalRows_rs_replies = mysql_num_rows($rs_replies);
============================================================================