Topic: Как объединить две темы?..

???? ??????...

? ???? ???? ??? ????: "?????????" ? "??? ?????????".
? ???? ?????????? ?? ? ???? ???? ??? ???????? ????????? ?? ?????? ???? ? ??????..... ??? ??? ????????

Respects, NeoTall

2

Re: Как объединить две темы?..

$row = $db->query("SELECT posted FROM prefix_posts WHERE topic_id=$idto DESC LIMIT 1");
$arr = $db->fetch_row($row);
$timestamp = $arr['posted'];
$result = $db->query("SELECT posted FROM prefix_posts WHERE topic_id=$idfrom");
while ($row1 = $db->fetch_row($result)) {
if ($row1['posted'] < $timestamp)
$result = $db->query("UPDATE prefix_posts SET topic_id=$idto, posted=$timestamp+1 WHERE topic_id=$idfrom")
else $result = $db->query("UPDATE prefix_posts SET topic_id=$idto WHERE topic_id=$idfrom");
}

??? ???? ??????
$idfrom - id ?????? ?????? ?????????? ?????
$idto - id ?????? ???? ?????????? ?????

???????, ??????? ???????????, ??? ??? ?? ??????, ?? ? ?????? ?????, ?? ????????. ???-?? ???? ?? ??

Hm... every pixel has it's own destiny

Re: Как объединить две темы?..

seva wrote:

???????, ??????? ???????????, ??? ??? ?? ??????, ?? ? ?????? ?????, ?? ????????. ???-?? ???? ?? ??

???????... ??????? ?? ??????...???????? ? ???????????......???? ???? ????????? ????? smile

Respects, NeoTall

Re: Как объединить две темы?..

NeoTall wrote:
seva wrote:

???????, ??????? ???????????, ??? ??? ?? ??????, ?? ? ?????? ?????, ?? ????????. ???-?? ???? ?? ??

???????... ??????? ?? ??????...???????? ? ???????????......???? ???? ????????? ????? smile

??? ?????? ???????... ???????? ???????!!!

Respects, NeoTall

5

Re: Как объединить две темы?..

??????? wink

Hm... every pixel has it's own destiny

6 (edited by nyuk 2005-10-20 05:27)

Re: Как объединить две темы?..

seva, prefix_ ????? ??????? ??????????, ?? ?? ????? ?????????? ? ?????. ?????????? ???????????? ?????????? $db_prefix.

? ???? ???????? ???????? ?????? ???:

        $db->query('UPDATE '.$db->prefix.'posts SET topic_id='.$new_tid.' WHERE topic_id='.$tid) or error('Unable to update posts', __FILE__, __LINE__, $db->error());
        $db->query('UPDATE '.$db->prefix.'topics SET num_replies=(SELECT COUNT(id) FROM posts WHERE topic_id='.$new_tid.') - 1 WHERE id='.$new_tid) or error('Unable to update new topic', __FILE__, __LINE__, $db->error());
        $db->query('UPDATE '.$db->prefix.'topics SET num_replies=(SELECT COUNT(id) FROM posts WHERE topic_id='.$tid.') - 1 WHERE id='.$tid) or error('Unable to update old topic', __FILE__, __LINE__, $db->error());

$tid - ?????? ?????.
$new_tid - ????? ?????.

? ??????? ?? ?????? ???????, ???? ??????????? ????????? ?? ??????????, ? ?????? ??? ????? ??????????.
???? ???????????? ??????? ??????? (??? ????????? ???????).
?? ????? ??? ?????? ???????, ????? ?????????? ????? ???????? ???????? last_post, last_post_id ? last_poster ? ???????.

P.S. ???????? ??? ?????? 1.0.1, ?? ????? ???-?? ???? ?????? ????????. ?? MySQL ?? ???????? (? ???? PostgreSQL).

Big Brother is not watching you, Big Brother is testing you

7

Re: Как объединить две темы?..

nyuk, ????? ?????????? ??????????????? ??????? ?????????. ???????? ?? ????????? ???????? ??? ???????????, ? ????? "??????" ??????? ???? ??? ????? ???????? ? ?????????? ? ???????????..

?????? ???? ????????: "???????? ????????? ?? ?????? ???? ? ??????". ? ???????, ??? ???? ??? ????????? ?? ????? ???? ???????? ? ????? ??????.

? ?????????, ????????.

Hm... every pixel has it's own destiny

8

Re: Как объединить две темы?..

?? ?? ???????? ?????, ??? ?????????????? ??????. :-)
??? ????? ?? ???????, ????? ? ?????????, ??????????? 15-??, ???? ????????? ????? ????? 25-?...

Big Brother is not watching you, Big Brother is testing you