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, 53 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 - How do I pull data from a table into a module? [ ]
 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
jimmyjimjim
Lieutenant
Lieutenant


Joined: Jan 23, 2003
Posts: 258

Location: USA

PostPosted: Thu Feb 06, 2003 7:49 pm Reply with quoteBack to top

I built a table called 'nuke_demo'.

It has 2 columns:
demo1 text not null
demo2 text not null

how can I get the text from the table into my new module?

I tried this...

function demo() {
global $demo1, $demo2;

if ($demo1 != "") {
echo "$demo1<br>\n";
}
if ($demo2 != "") {
echo "$demo2<br>\n";
}
}

It obviously didn't work. I'm using php-nuke 6.5b6 at my test site.

Any suggestions?
Find all posts by jimmyjimjimView user's profileSend private message
Zhen-Xjell
Nuke Cops Founder
Nuke Cops Founder


Joined: Nov 14, 2002
Posts: 5939


PostPosted: Thu Feb 06, 2003 7:51 pm Reply with quoteBack to top

You have to call it via a mysql select query:

select * from demo;

And assign it to variables that you can use.

_________________
Paul Laudanski, Microsoft MVP Windows-Security
CastleCops: [de] [en] [wiki]
Find all posts by Zhen-XjellView user's profileSend private messageSend e-mailVisit poster's website
jimmyjimjim
Lieutenant
Lieutenant


Joined: Jan 23, 2003
Posts: 258

Location: USA

PostPosted: Thu Feb 06, 2003 7:58 pm Reply with quoteBack to top

Sorry, I'm a little lost.

I understand that:
$sql = "SELECT * FROM demo";

but what do you mean by assign variables that I can use?
Find all posts by jimmyjimjimView user's profileSend private message
Zhen-Xjell
Nuke Cops Founder
Nuke Cops Founder


Joined: Nov 14, 2002
Posts: 5939


PostPosted: Thu Feb 06, 2003 8:06 pm Reply with quoteBack to top

Example from index.php:

$sql = "SELECT * FROM ".$prefix."_referer";
$result = $db->sql_query($sql);
$numrows = $db->sql_numrows($result);
if($numrows>=$httprefmax) {
$sql = "DELETE FROM from ".$prefix."_referer";
$result = $db->sql_query($sql);
}

_________________
Paul Laudanski, Microsoft MVP Windows-Security
CastleCops: [de] [en] [wiki]
Find all posts by Zhen-XjellView user's profileSend private messageSend e-mailVisit poster's website
chatserv
General
General


Joined: Jan 12, 2003
Posts: 3128

Location: Puerto Rico

PostPosted: Thu Feb 06, 2003 8:16 pm Reply with quoteBack to top

More or less, it'd come up to something like:
Code:

function demo() {
$sql = "SELECT demo1, demo2 FROM ".$prefix."_demo";
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $demo_one = $row[demo1];
    $demo_two = $row[demo2];
if ($demo_one != "") {
echo "$demo_one<br>\n";
 }
if ($demo_two != "") {
echo "$demo_two<br>\n";
 }
}
Find all posts by chatservView user's profileSend private messageVisit poster's website
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.325 Seconds - 343 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::