Topic: Как объединить две темы?..
???? ??????...
? ???? ???? ??? ????: "?????????" ? "??? ?????????".
? ???? ?????????? ?? ? ???? ???? ??? ???????? ????????? ?? ?????? ???? ? ??????..... ??? ??? ????????
You are not logged in. Please login or register.
PunBB Forums → Archive → Как объединить две темы?..
???? ??????...
? ???? ???? ??? ????: "?????????" ? "??? ?????????".
? ???? ?????????? ?? ? ???? ???? ??? ???????? ????????? ?? ?????? ???? ? ??????..... ??? ??? ????????
$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 ?????? ???? ?????????? ?????
???????, ??????? ???????????, ??? ??? ?? ??????, ?? ? ?????? ?????, ?? ????????. ???-?? ???? ?? ??
???????, ??????? ???????????, ??? ??? ?? ??????, ?? ? ?????? ?????, ?? ????????. ???-?? ???? ?? ??
???????... ??????? ?? ??????...???????? ? ???????????......???? ???? ????????? ?????
seva wrote:???????, ??????? ???????????, ??? ??? ?? ??????, ?? ? ?????? ?????, ?? ????????. ???-?? ???? ?? ??
???????... ??????? ?? ??????...???????? ? ???????????......???? ???? ????????? ?????
??? ?????? ???????... ???????? ???????!!!
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).
nyuk, ????? ?????????? ??????????????? ??????? ?????????. ???????? ?? ????????? ???????? ??? ???????????, ? ????? "??????" ??????? ???? ??? ????? ???????? ? ?????????? ? ???????????..
?????? ???? ????????: "???????? ????????? ?? ?????? ???? ? ??????". ? ???????, ??? ???? ??? ????????? ?? ????? ???? ???????? ? ????? ??????.
? ?????????, ????????.
?? ?? ???????? ?????, ??? ?????????????? ??????. :-)
??? ????? ?? ???????, ????? ? ?????????, ??????????? 15-??, ???? ????????? ????? ????? 25-?...
PunBB Forums → Archive → Как объединить две темы?..
Powered by PunBB, supported by Informer Technologies, Inc.