function numberofcomments($suggestion_id) { $database = DB::getInstance(); $db = $database->getConnection(); $mysql['suggestion_reply_to_id'] = $db->real_escape_string($suggestion_id); $suggestion_sql = "SELECT * FROM suggestions WHERE suggestion_reply_to_id='" . $mysql['suggestion_reply_to_id'] . "' ORDER BY suggestion_votes DESC"; $suggestion_result = _mysqli_query($suggestion_sql); //($suggestion_sql); $comments['from'] = $suggestion_result->num_rows; if ($comments['from'] > 0) { $comments['to'] = $comments['from']; while ($suggestion_row = $suggestion_result->fetch_array()) { $comments2 = numberofcomments($suggestion_row['suggestion_id']); $comments['to'] = $comments['to'] + $comments2['to']; } } return $comments; }
function numberofcomments($suggestion_id) { $mysql['suggestion_reply_to_id'] = mysql_real_escape_string($suggestion_id); $suggestion_sql = "SELECT * FROM suggestions WHERE suggestion_reply_to_id='" . $mysql['suggestion_reply_to_id'] . "' ORDER BY suggestion_votes DESC"; $suggestion_result = _mysql_query($suggestion_sql); //($suggestion_sql); $comments['from'] = mysql_num_rows($suggestion_result); if ($comments['from'] > 0) { $comments['to'] = $comments['from']; while ($suggestion_row = mysql_fetch_array($suggestion_result)) { $comments2 = numberofcomments($suggestion_row['suggestion_id']); $comments['to'] = $comments['to'] + $comments2['to']; } } return $comments; }