Re: lug-bg: MySQL query (2)
- Subject: Re: lug-bg: MySQL query (2)
- From: gf@xxxxxxxxxxx (Georgi Chorbadzhiyski)
- Date: Tue, 19 Nov 2002 04:17:27 +0200
Teodor Penev wrote:
> Privet *.
>
> Oshte edin vypros imam, okolo insertion tozi pyt :)
>
> Taka - poletata se vikat v momenta 'by id desc' (namaliavashto).
> Celta e kato se opredlei edi-koi si zapis da se insertva pod nego.
> Tova kato teoria si protivorechi dosta, taka che predpolagam che
> na PHP-alone triabva da go pravia...no vsiakakvi shturi idei sa
> welcome :)
>
> Prim. pri izbran field '18' zapisa otiva pod nego:
>
> 21 >---+
> 20 ....|
> 19 ....|
> 18 ....|
> 18-1 <-+
>
> V malko poveche detaili - pisha forum, ta zapisite koito bivat replies triabva da se displayvat pod parent-a...
Tova koeto go pishesh go pishesh po mnogo greshen nachin. Triabva
ti neshto ot sorta (mnogo elementarno i dyrveno napraveno v sluchaia)
create table posts (
id serial,
parent int default null
ts int,
subj text,
text text
);
v parent poleto pishesh na koi post e otgovora. Ako e null
znachi e tema.
posle imash pokazvane na postove (50-te nai-novi)
elect * from posts where parent is null order by ts desc limit 50;
imash i pokazvane na thread
elect * from posts where id = XXX or parent = XXX order by ts;
Gore dolu tova e ( - greshkite :)
Estestveno v istinski forum shte e hubavo da pazish BODY-to na posta
otdeleno ot subject (za po byrzo tyrsene) i shte imash oshte danni
koi go e postnal IP, proxy, etc.
Otidi na www.phorum.org i si svali soft-a. Razgledai strukturata na
DB-to i go razberi. Tozi forum raboti s mysql i postgres taka che niama
da sreshtnesh "mysql only braindamage".
--
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
|