Google

NukeCoder


View next topic
View previous topic
Post new topic   Reply to topic
Author Message
trunks




Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom

PostPosted: Tue Jan 13, 2009 5:36 am
Reply with quote

Hi gotcha, im working on creating a block to show how many items i have and total categories.

Fairly new to this but ive been messing with it for a while now but to no avail, heres what i have so far:

Code:

if ( !defined('NUKE_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $db;

$content = '<table>';

//Total Amount of Categories
$result1 = $db->sql_query($db->sql_query("SELECT * FROM ".$prefix."_shop_categories "));
//Total Themes
$result2 = $db->sql_query($db->sql_query("SELECT * FROM ".$prefix."_shop_items "));         

$content .= "<center> Total Categories: $result1  <br> Total Themes: $result2</center>";

$content .= "</table>";



Can you help out at all?

-Trunks
 
View user's profile Send private message Visit poster's website MSN Messenger
gotcha
Site Admin
Site Admin



Joined: Oct 25, 2004
Posts: 921

PostPosted: Tue Jan 13, 2009 9:47 am
Reply with quote

There were a few problems with that code, but this should work for you...

Code:

if ( !defined('NUKE_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $db;


//Total Amount of Categories
$result1 = $db->sql_query($db->sql_query("SELECT * FROM shop_categories "));
$num_cats = $db->sql_numrows($result1);

//Total Themes
$result2 = $db->sql_query($db->sql_query("SELECT * FROM shop_items "));
$num_items = $db->sql_numrows($result2);

$content = "<center> Total Categories: $num_cats  <br> Total Themes: $num_items</center>";

 
View user's profile Send private message Visit poster's website
trunks




Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom

PostPosted: Tue Jan 13, 2009 4:22 pm
Reply with quote

Ahh i see what its doing now, please correct me if im wrong, i want to understand the code thats all...

first line is calling for the information to be pulled equalling result. Then number of cats/items is pulled from the result?

_________________
www.php-clans.com - Web Hosts Specialising in PHPNuke and Gaming Communities. 
View user's profile Send private message Visit poster's website MSN Messenger
trunks




Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom

PostPosted: Tue Jan 13, 2009 4:25 pm
Reply with quote

Hmm i've updated the code in the block, and nothing shows up, only the

total categories:
total items:

Any ideas? :S

_________________
www.php-clans.com - Web Hosts Specialising in PHPNuke and Gaming Communities. 
View user's profile Send private message Visit poster's website MSN Messenger
gotcha
Site Admin
Site Admin



Joined: Oct 25, 2004
Posts: 921

PostPosted: Thu Jan 15, 2009 1:13 pm
Reply with quote

looks like there is a double $db->sql_query in there that I copied over from your example.

Try this

Code:

if ( !defined('NUKE_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $db;


//Total Amount of Categories
$result1 = $db->sql_query("SELECT * FROM shop_categories");
$num_cats = $db->sql_numrows($result1);

//Total Themes
$result2 = $db->sql_query("SELECT * FROM shop_items");
$num_items = $db->sql_numrows($result2);

$content = "<center> Total Categories: $num_cats  <br> Total Themes: $num_items</center>";
 
View user's profile Send private message Visit poster's website
trunks




Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom

PostPosted: Sun Jan 18, 2009 10:14 am
Reply with quote

Works a treat thanks very much. Didnt realise i put that query in twice =/

Is there a way to implement a random theme image underneath that? i seem to be getting myself lost.

_________________
www.php-clans.com - Web Hosts Specialising in PHPNuke and Gaming Communities. 
View user's profile Send private message Visit poster's website MSN Messenger
trunks




Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom

PostPosted: Sun Apr 05, 2009 6:53 am
Reply with quote

still no luck Sad
 
View user's profile Send private message Visit poster's website MSN Messenger
gotcha
Site Admin
Site Admin



Joined: Oct 25, 2004
Posts: 921

PostPosted: Fri Apr 17, 2009 9:44 am
Reply with quote

Did you want to get a random image or a random product with an image? I ask because images are stored in their own table since items can have multiple images. The included blocks show how to get items. Just replace the ORDER BY xxx with ORDER BY rand()
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous 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
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 5 Hours
Forums ©