Oto zapytanie SQL:
SELECT t.threadid, t.lastpostid, t.title, t.lastpost, t.lastposter, t.views, t.replycount, t.forumid, f.title FROM ".PREFIX_FORUM."thread t LEFT JOIN ".PREFIX_FORUM."forum f ON t.forumid = f.forumid ORDER BY t.lastpost DESC LIMIT 0,".$maxlatesttopics"
W kolejności
- ID tematu
- ID Postu
- Nazwa tematu
- Data ostatniego postu (podana w czasie UNIX-owym)
- Autor ostatniego postu
- ile razy przeglądany był post
- odpowiedzi
- ID forum
- Nazwa Forum
I tu się pojawia moje pytanie. W jaki sposób mam przypisać tabele by nie kolidować tych samych kolumn? Robiąc to w SQL'u ułatwiłoby mi zadanie.
Podam fragment kodu PHP, jeżeli będzie wszystko w porządku.
Oczekuję pomocy z waszej strony.
$topictitle_full = clearfromtags($bdfgr['t.title']); // chodzi o tą część $topictitle = unhtmlspecialchars($topictitle_full); if(mb_strlen($topictitle)>$maxlatesttopicchars) { $topictitle=mb_substr($topictitle, 0, $maxlatesttopicchars); $topictitle.='...'; } $last_poster = $bdfgr['lastposter']; $board = $bdfgr['f.title']; // i o tą $boardlink = '<a href="forumdisplay.php?f='.$bdfgr['forumid'].'">'.$board.'</a>'; $topiclink = '<a href="showthread.php?t='.$bdfgr['threadid'].'&p='.$bdfgr['lastpostid']'#post'.$bdfgr['lastpostid']'" onmouseover="showWMTT(\'latesttopics_'.$n.'\')" onmouseout="hideWMTT()">'.$topictitle.'</a>'; $replys = $bdfgr['replycount']; }
Pozdrawiam