http://www.9dragonsonline.info/
nie używam żadnego cms, a newsy są pisane przez prosty panel php i w miejscu "Komentarze na forum" chciałbym umieścić napis "Komentarzy na forum (LICZBA x)". Czy istnieje jakieś proste zapytanie na taki wynik
Kod: Zaznacz cały
$topic_id = 3; // przykład
$sql = "SELECT topic_replies FROM " . TOPICS_TABLE . " WHERE topic_id = $topic_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) )
echo $row['topic_replies'];
}Kod: Zaznacz cały
$topic_id = 3; // przykład
$sql = "SELECT topic_replies FROM " . TOPICS_TABLE . " WHERE topic_id = $topic_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) ) {
echo $row['topic_replies'];
}Kod: Zaznacz cały
<?php
require './aaa/connect.php';
$topic_id = 8814; // przykład
$sql = "SELECT topic_replies FROM " . TOPICS_TABLE . " WHERE topic_id = $topic_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) ) {
echo $row['topic_replies'];
}
?> Kod: Zaznacz cały
<?php
mysql_connect('mysql.forall.pl', 'web777', '************');
mysql_select_db('usr_web777_1');
?>