Numbers Formatting

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Numbers Formatting
XERXES
CZ Super Newbie
XERXES has been a member for over 20 year's 20 Year Member
usa.gif florida.gif
Age: 55
Gender: Male
Status: Offline
Joined: Aug 04, 2004
0.00 posts per day
Posts: 32
Points: 22,073
   
I recently installed the MarketPlace mod and have it working okay. I noticed that the Points and Posts numbers are not formatted to include the "," to seperate the thousands from the hundreds. I know this is probably a setting in the sql database field that the points and posts numbers are stored in, but I cannot find out what I should change to fix the formatting.

Any ideas would be much appreciated.
TIA



Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
You use the php function number_format. If your number was 5678341


number_format(5678341);


would return 5,678,341 just replace the actual number with your variable or string.



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: Numbers Formatting
XERXES
CZ Super Newbie
XERXES has been a member for over 20 year's 20 Year Member
usa.gif florida.gif
Age: 55
Gender: Male
Status: Offline
Joined: Aug 04, 2004
0.00 posts per day
Posts: 32
Points: 22,073
   
Thank you very much, Telli. You are definately "Tha Man" and your site is "Tha Bomb" for us nuke newbies.

Good thing I waited for an answer before messing with the database. icon_eek.gif



Back to top Reply with quote
#4   re: Numbers Formatting
Browser
CZ Super Newbie
 Codezwiz Site Donator
Browser has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Nov 14, 2004
0.01 posts per day
Posts: 48
Points: 5,631
   
How would I format the numbers for this block code?

<?php


if (eregi("block-Total_Hits.php", $PHP_SELF)) {
Header("Location: index.php");
die();
}

global $nukeurl, $prefix, $startdate;
$result = mysql_query("SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'");
$result = mysql_fetch_row ($result);
$content = '<center><small>'._WERECEIVED.'</small><br> '.$result[0].'<br><small>'._PAGESVIEWS.' '.$startdate.'</small></center>';


?>



Back to top Reply with quote
#5   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   

<?php
if (eregi("block-Total_Hits.php", $_SERVER['SCRIPT_NAME'])) {
    Header("Location: index.html");
    die();
}

global $nukeurl, $prefix, $startdate, $db;
$result = $db->sql_query("select count from ".$prefix."_counter order by type desc");
    list($total_hits) = $db->sql_fetchrow($result);
$total_hits = number_format($total_hits);
$content = "<font class=\"tiny\"><center>"._WERECEIVED."<br><b><a href=\"stats.html\">$total_hits</a></b><br>"._PAGESVIEWS." $startdate</center></font>";
?>




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#6   re: Numbers Formatting
Browser
CZ Super Newbie
 Codezwiz Site Donator
Browser has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Nov 14, 2004
0.01 posts per day
Posts: 48
Points: 5,631
   
I get the error:

Parse error: parse error, unexpected T_STRING

Do I have to change $_SERVER['SCRIPT_NAME'] to something? I am very new at php coding (I am reading php for dummies now trying to learn basics)

Thanks for the help!



Back to top Reply with quote
#7   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Try it now. I don't see anywhere that would cause the error but I changed the sql query none the less. Also make sure there no spaces after the closing ?> if your using a text editor that can happen quite frequently.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#8   re: Numbers Formatting
Browser
CZ Super Newbie
 Codezwiz Site Donator
Browser has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Nov 14, 2004
0.01 posts per day
Posts: 48
Points: 5,631
   
I am still getting the same error. Here is the whole phpnuke block (there is no space at the end, I am using bbedit as my text editor):

<?php

########################################################################
# PHP Nuke Block: Total Hits v0.1 #
# #
# Copyright (c) 2001 by C. Verhoef (cverhoef@gmx.net) #
# #
########################################################################
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License. #
########################################################################


if (eregi("block-Total_Hits.php", $_SERVER['SCRIPT_NAME'])) {
    Header("Location: index.php");
    die();
}

global $nukeurl, $prefix, $startdate;
$result = mysql_query("SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'");
$result = mysql_fetch_row ($result);
$content = '<center><small>'._WERECEIVED.'</small><br> '.$result[0].'<br><small>'._PAGESVIEWS.' '.$startdate.'</small></center>';


?>



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
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