I apologize if this is a double post, but it appears
that my first message didn't transmit for some reason.

Anyway, I'm having a weird problem with decimals.
Imagine a field with just two numerals - 450 and 24.8.
You want to display them as 450 and 24.8, not 450.05
and 24.8 or 450 and 3.

I designated a field Decimal 3,1. When I put a PHP
query on my page, it displayed 450 as 450, but it
rounded the fractions off, turning 24.8 into 25.

So I went back to my spreadsheet and changed every
cell to TEXT before exporting it into a new CSV file.
I imported it into MySQL but got the same results.

Next, I changed the field to Char 3, emptied the table
and re-imported the CSV file. To my amazement, I get
the same results.

Yet when I browsed my table in phpMyAdmin, I saw the
data displayed as 450 and 24.8, just like I wanted. So
I can't figure out why it doesn't display like that.

Actually, I'd like to change it just a bit. This table
focuses on geological time. Rather than translate
everything into a common unit (millions, billions,
etc.), I decided to use both millions and billions and
distinguish them by font color.

For example, a yellow 2.5 would represent 2.5 BILLION,
while a white 340 would represent 340 MILLION. The
only remaining problem is the end of the Ice Age,
10,000 years ago. That would equal .01 million years.

Still, I ought to be able to handle this with a Char
or Varchar, shouldn't I?

This is the script I'm using to display it, where
YearBegan and YearEnded equal the beginning and ending
dates of various geological periods:

echo '<table class="sortphp" id="tab_geotime"
style="font-size: 85%; line-height: 130%;">
           <tbody>';
  //<!-- BeginDynamicTable -->
  while ($row = mysql_fetch_array ($res)) {

// and add this in your while loop:
$YearBegan_arr[] = $row['YearBegan'];
     echo "<tr class=\"". $row['IDParentTime'] ."\"
id=\"". $row['IDTime'] ."\"><td class=\"name\"><a
href=\"javascript:;\"onclick=\"MM_openBrWindow('/time/bits/".$row['IDTime'].".php','TimeHelp','menubar=yes,scrollbars=yes,resizable=yes,width=300,height=250')\">
         ". $row['NameTime'] ." ". $row['TimeType']
."</a></td>
      <td class=\"date\">" .
number_format($row['YearBegan']) . "-" .
number_format($row['YearEnded']) . "</td>
          <td class=\"border\"></td></tr>\n";
       $nameTypes[]=$row['NameTime'];
  }
  }
  ?>
      </tr>
      </tbody>
      </table>

Thanks for any insights.


        
                
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to