| Author |
Message |
trunks

Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom
|
Posted:
Tue Jan 13, 2009 5:36 am |
|
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 |
| |
|
|
 |
gotcha
Site Admin


Joined: Oct 25, 2004
Posts: 921
|
Posted:
Tue Jan 13, 2009 9:47 am |
|
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>";
|
|
| |
|
|
 |
trunks

Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom
|
Posted:
Tue Jan 13, 2009 4:22 pm |
|
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. |
|
|
 |
trunks

Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom
|
Posted:
Tue Jan 13, 2009 4:25 pm |
|
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. |
|
|
 |
gotcha
Site Admin


Joined: Oct 25, 2004
Posts: 921
|
Posted:
Thu Jan 15, 2009 1:13 pm |
|
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>"; |
|
| |
|
|
 |
trunks

Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom
|
Posted:
Sun Jan 18, 2009 10:14 am |
|
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. |
|
|
 |
trunks

Joined: Jan 10, 2008
Posts: 57
Location: United Kingdom
|
Posted:
Sun Apr 05, 2009 6:53 am |
|
still no luck  |
| |
|
|
 |
gotcha
Site Admin


Joined: Oct 25, 2004
Posts: 921
|
Posted:
Fri Apr 17, 2009 9:44 am |
|
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() |
| |
|
|
 |
|
|