Nukemods Forum  
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» .::.
tattoo fonts
http://www.checkoutmyink.com/category/tattoo-fonts-tattoo

Go Back   Nukemods Forum > PHP-Nuke 7.x > Nuke 7.x - Blocks

Reply
 
LinkBack Thread Tools Display Modes
Making a block, got no output.
Old
  (#1 (permalink))
Junior Member
 
Status: Offline
Posts: 4
Join Date: Oct 2004
Location: Smiths Falls
Making a block, got no output. - 10-18-2004, 05:16 PM

Here's the code:
Code:
<?
if (eregi("block-Cheats.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}

ob_start();
global $prefix, $dbi;
include("modules/Cheats/config.php");
$latest = "SELECT * FROM '".$prefix."'_cheats DESC LIMIT 5";
$latest = mysql_query($latest);
$count = mysql_num_rows($latest);

$content = "5 Latest Cheats
";

While ($show = MySQL_fetch_array($latest)){
	$cname = $show['cheat_game'];
	$cheat = $show['cheat_cheat'];
	$cheat = "$cheat[0]$cheat[1]$cheat[2]$cheat[3]$cheat[4]";

	$content .= "$cheat - $cname
";
}
	$content .= "We have $count cheats";
ob_end_clean();
?>
No errors, but it just won't out put any MySQL data.
  Send a message via AIM to Lang Send a message via MSN to Lang  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#2 (permalink))
Moderator
 
Status: Offline
Posts: 260
Join Date: Oct 2004
10-18-2004, 05:24 PM

here u go
Code:
<?
if (eregi("block-Cheats.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

global $prefix, $db;
include("modules/Cheats/config.php");
$sql = "SELECT * FROM '".$prefix."'_cheats DESC";
$result = $db->ql_query($sql);
$row = $db->sql_fetchrowset($result);
$count = count($row);

$content = "".$count." Latest Cheats
";

for ($i = 0; $i < count($row); $i++)
{
   $cname = $row[$i]['cheat_game'];
   $cheat = $row[$i]['cheat_cheat'];
   $cheat = "$cheat[0]$cheat[1]$cheat[2]$cheat[3]$cheat[4]";

   $content .= "$cheat - $cname
";
}
   $content .= "We have $count cheats";

?>
haven't test it but i think it will work.
btw y do u want to include the cheats config? i don't see any use of it in this block.
edit, now i see it better the
Code:
   $cheat = $row[$i]['cheat_cheat'];
   $cheat = "$cheat[0]$cheat[1]$cheat[2]$cheat[3]$cheat[4]";
won't work cause i see that u want the $chat to be an array but since i don't see the result of it i can make sure i will work. Maybe u should post an example of what you want to print?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#3 (permalink))
Junior Member
 
Status: Offline
Posts: 4
Join Date: Oct 2004
Location: Smiths Falls
10-18-2004, 05:29 PM

IN the config you can specify x amount of cheats t be displayed
  Send a message via AIM to Lang Send a message via MSN to Lang  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#4 (permalink))
Moderator
 
Status: Offline
Posts: 260
Join Date: Oct 2004
10-18-2004, 05:30 PM

Quote:
Originally Posted by chatserv
Code:
<? 
if (eregi("block-Cheats.php", $PHP_SELF)) { 
Header("Location: index.php"); 
die(); 
} 

ob_start(); 
global $prefix, $dbi; 
include("modules/Cheats/config.php"); 
$latest = "SELECT * FROM ".$prefix."_cheats DESC LIMIT 5"; 
$latest = sql_query($latest, $dbi); 
$count = sql_num_rows($latest, $dbi); 

$content = "5 Latest Cheats
"; 

While ($show = sql_fetch_array($latest, $dbi)){ 
   $cname = $show['cheat_game']; 
   $cheat = $show['cheat_cheat']; 
   $cheat = "$cheat[0]$cheat[1]$cheat[2]$cheat[3]$cheat[4]"; 

   $content .= "$cheat - $cname
"; 
} 
   $content .= "We have $count cheats"; 
ob_end_clean(); 
?>
the
Code:
$count = sql_num_rows($latest, $dbi);
is useless because he limits his query to 5.
and using $dbi is old and FB said to start using the new db layer.
:wink:
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#5 (permalink))
Moderator
 
Status: Offline
Posts: 260
Join Date: Oct 2004
10-18-2004, 05:32 PM

Quote:
Originally Posted by Lang
IN the config you can specify x amount of cheats t be displayed
yes, but u limited your query to 5 so i can't see any real use of it. and if you limit your query u can't get the real number of cheats so u will need to run the same query again.
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#6 (permalink))
Moderator
 
Status: Offline
Posts: 338
Join Date: Jan 2003
10-18-2004, 05:40 PM

no worries, i dropped mine anyway as you had posted before me. All i had done is add means for it to connect to the db, what is used on the queries i did not check as i don't have those tables and thus can't check it.
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#7 (permalink))
Junior Member
 
Status: Offline
Posts: 4
Join Date: Oct 2004
Location: Smiths Falls
10-18-2004, 05:45 PM

I want the first 4 letters of the cheat to appear.
  Send a message via AIM to Lang Send a message via MSN to Lang  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#8 (permalink))
Moderator
 
Status: Offline
Posts: 260
Join Date: Oct 2004
10-18-2004, 05:51 PM

then u may want to use this
Code:
$cheat = substr("$row[$i]['cheat_cheat']", 0, 4);
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#9 (permalink))
Junior Member
 
Status: Offline
Posts: 4
Join Date: Oct 2004
Location: Smiths Falls
10-19-2004, 10:46 AM

I used that and I got ['ch

Anyways, my "We have x cheats" works but it won't display the 1 cheat that I added. Xero, your way may work, but I like the classical way that I had. I understand it alot better.
  Send a message via AIM to Lang Send a message via MSN to Lang  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old
  (#10 (permalink))
Moderator
 
Status: Offline
Posts: 260
Join Date: Oct 2004
10-19-2004, 11:34 AM

That way i wrote is fast and uses only 2 sql queries.
do u have in your (prefix)_cheats table cheat_cheat and cheat_game rows?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making someone a Mod LunaFaye Nuke 7.x - General 2 08-08-2005 06:00 PM
Plz help Warning: ob_start(): output handler 'ob_gzhandler' Rebel786 Nuke 7.x - General 2 07-25-2004 01:28 AM
Mod-Making Sternzy Nuke 6.5 to 6.9 - Modules 1 07-27-2003 08:04 AM
Need Help making with my user block Elite311 Purged Topics 5 03-09-2003 11:01 PM
Help with upload mod im making zigx Open topics 13 12-13-2002 06:26 PM




vBulletin Skin developed by: vBStyles.com


LinkBacks Enabled by vBSEO 3.3.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31