You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 45 guest(s) and 1 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Simple modification request to block-Last_5_Articles [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
conefth
Nuke Cadet
Nuke Cadet


Joined: Jan 20, 2005
Posts: 4


PostPosted: Sat Mar 11, 2006 1:08 am Reply with quoteBack to top

Hi,

I don't know if this is the correct Forum to post my request so please feel free to move it if it's not.

I am trying to modify the code in block-Last_5_Articles so that it shows the Topic's title and below it the Article's title. This is what I have done thus far:
Code:
$content = "<table width=\"100%\" border=\"0\">";
$result = $db->sql_query("SELECT sid, title, topic FROM " . $prefix . "_stories $querylang ORDER BY sid DESC LIMIT 0,5");
while ($row = $db->sql_fetchrow($result)) {
    $sid = intval($row['sid']);
    $title = stripslashes($row['title']);
    $topic = intval($row['topic']);
    $content .= "<tr><td align=\"center\"><STRONG><a href=\"modules.php?name=News&amp;new_topic=$topic\">$topic</a></STRONG><BR><a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid\">$title</a></td></tr>";
}
$content .= "</table>";
$content .= "<br><center>[ <a href=\"modules.php?name=News\">"._MORENEWS."</a> ]</center>";

It works just fine, but there is one major problem. Instead of the Topic's title, I get the Topic's ID. I think that somehow I should select the 'topictext' from 'nuke_topics' table. My problem is that I don't know how to do that because my knowledge of php and sql is very limited. I think that it could be a very simple task for some of you so could you please paste here the code I should use?

Thank you
Find all posts by conefthView user's profileSend private message
webjunky
Lieutenant
Lieutenant


Joined: May 11, 2003
Posts: 167


PostPosted: Sat Mar 11, 2006 1:14 am Reply with quoteBack to top

Something like this

$content = "<table width=\"100%\" border=\"0\">";
$result = $db->sql_query("SELECT sid, title, topic FROM " . $prefix . "_stories $querylang ORDER BY sid DESC LIMIT 0,5");
while ($row = $db->sql_fetchrow($result)) {
$sid = intval($row['sid']);
$title = stripslashes($row['title']);
$topic = intval($row['topic']);


$result2 = $db->sql_query("SELECT topictext FROM " . $prefix . "_topics WHERE tid='$topic'");
while ($row2 = $db->sql_fetchrow($result2)) {


$topictext = stripslashes($row2['topictext']);

$content .= "<tr><td align=\"center\"><STRONG><a href=\"modules.php?name=News&amp;new_topic=$topic\">$topictext</a></STRONG><BR><a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid\">$title</a></td></tr>";
}
}
$content .= "</table>";
$content .= "<br><center>[ <a href=\"modules.php?name=News\">"._MORENEWS."</a> ]</center>";

_________________
- Do not pm me for help -
Find all posts by webjunkyView user's profileSend private message
conefth
Nuke Cadet
Nuke Cadet


Joined: Jan 20, 2005
Posts: 4


PostPosted: Sat Mar 11, 2006 1:36 am Reply with quoteBack to top

Thanks a million webjunky. With just a few minor modifications to what you gave me it now works exactly like I want it to:
Code:
$content = "<table width=\"100%\" border=\"0\">";
$result = $db->sql_query("SELECT sid, title, topic FROM " . $prefix . "_stories $querylang ORDER BY sid DESC LIMIT 0,5");
while ($row = $db->sql_fetchrow($result)) {
    $sid = intval($row['sid']);
    $title = stripslashes($row['title']);
    $topicid = intval($row['topic']);
    $result2 = $db->sql_query("SELECT topictext FROM " . $prefix . "_topics WHERE topicid='$topicid'");
    while ($row2 = $db->sql_fetchrow($result2)) {
        $topic = stripslashes($row2['topictext']);
        $content .= "<tr><td align=\"center\"><STRONG><a href=\"modules.php?name=News&amp;new_topic=$topicid\">$topic</a></STRONG><BR><a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid\">$title</a></td></tr>";
}
}
$content .= "</table>";
Find all posts by conefthView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.469 Seconds - 421 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::