Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> komentarze w ewsach
invx
post
Post #1





Grupa: Zablokowani
Postów: 655
Pomógł: 0
Dołączył: 28.11.2003
Skąd: Zagórz

Ostrzeżenie: (80%)
XXXX-


robie system newsow, utknolem na zliczaniu komentarzy:
mam taki kod:
[php:1:2f83a9b3f6]<?php
function czytaj_newsa ()
{
mysql_connect("127.0.0.1", "root", "krasnal") or die ("nie można polączyć się z bazą");
mysql_select_db(rcx) or die ("nie można wybrac bazy");

$zapytanie="SELECT * FROM news_a";

$ilosc = "SELECT * FROM comments WHERE subid='".$wiersz['id']."'";

$komentarze = mysql_query($ilosc);

$ilosckomentarzy = mysql_num_rows($komentarze);

$wykonaj=mysql_query($zapytanie);

while($wiersz=mysql_fetch_array($wykonaj))
{
echo "
<center>
<table align='center' width='420' cellspacing='0' cellpadding='0' border='1' style='border-collapse: collapse' bgcolor='#c0c0c0' bordercolor='#111111'>
<tr>
<td class='news'><b>$wiersz[tytul]:</b>$wiersz[data]
</td>
</tr>
</table>
<table>
<tr>
<td width='420' bgcolor='#FFFFFF' align='justify'>$wiersz[tresc]<br><br></td>
</tr>
<tr>
<td width='420' bgcolor='#efefef' align='left'>.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dodał:&nbsp;<b><a href='mailto:$wiersz[mailu]'>$wiersz[dodal]</a></b></td>
<tr>
<td>
".$ilosckomentarzy."
</td>
</tr>
</tr>
</table><br>
</center>
";
}

#echo"<a name='dol'></a>";
#echo"<center><font color='#808080' size='2'>";
}
?>[/php:1:2f83a9b3f6]
i nie wykonuje zliczania komentarzy tylko wyswietla tresc zmiennej.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
invx
post
Post #2





Grupa: Zablokowani
Postów: 655
Pomógł: 0
Dołączył: 28.11.2003
Skąd: Zagórz

Ostrzeżenie: (80%)
XXXX-


[sql:1:64b1d3e875]#
# Struktura tabeli dla `news_a`
#

CREATE TABLE `news_a` (
`id` int(8) NOT NULL auto_increment,
`data` date NOT NULL default '0000-00-00',
`tytul` blob NOT NULL,
`tresc` blob NOT NULL,
`dodal` varchar(255) NOT NULL default '',
`ukrywanie` char(1) NOT NULL default '0',
`mailu` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=40 ;

#
# Zrzut danych tabeli `news_a`
#

INSERT INTO `news_a` VALUES (39, '0000-00-00', '', '', 'ttrrrrrrrrrrrrrr', '0', 'tttttttt');
INSERT INTO `news_a` VALUES (35, '0000-00-00', 0x5757575757, 0x57575757575757, 'WWWWWWWWWWW', '0', 'WWWWWWWWWWWWWWW');
INSERT INTO `news_a` VALUES (36, '0000-00-00', 0x57575757545, 0x5755757575745454520, 'WWWWWWWWEEE', '0', 'WWWWWWWWEEE');
[/sql:1:64b1d3e875]

[sql:1:64b1d3e875]

#
# Struktura tabeli dla `news_b`
#

CREATE TABLE `news_b` (
`id` int(8) NOT NULL auto_increment,
`id_news` varchar(8) NOT NULL default '',
`temat` text NOT NULL,
`tresc` blob NOT NULL,
`nick` varchar(255) NOT NULL default '',
`data` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=3 ;

#
# Zrzut danych tabeli `news_b`
#

INSERT INTO `news_b` VALUES (1, '1', 'sgs geqwt qe rt', '', 'et wet w', '0000-00-00 00:00:00');
INSERT INTO `news_b` VALUES (2, '1', 'sgwet we', '', 'et ew', '0000-00-00 00:00:00');
[/sql:1:64b1d3e875]
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 12.10.2025 - 21:58