Home | Webstore
Latest News: OOTP 26 Available - FHM 12 Available - OOTP Go! Available

Out of the Park Baseball 26 Buy Now!

  

Go Back   OOTP Developments Forums > Out of the Park Baseball 26 > OOTP Mods > OOTP Mods - Database Tools

OOTP Mods - Database Tools Do you need to take a dump? SQL gurus welcome

Reply
 
Thread Tools
Old 08-04-2006, 12:52 PM   #1
Zubes
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
Converting Height?

anyone know how any tips on how to convert the height in the sql dumps from cm to feet and inches using mysql? thanks.
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 08-28-2006, 11:00 PM   #2
Zubes
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
anyone???
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 08-29-2006, 02:08 AM   #3
21C
Major Leagues
 
Join Date: Mar 2003
Location: Newcastle, Australia
Posts: 302
Divide it by 2.54 to get it into inches.

Edit - sorry, didn't see the part about doing it in MySQL. Can't help you with that.

Last edited by 21C; 08-29-2006 at 09:21 AM.
21C is offline   Reply With Quote
Old 09-05-2006, 06:15 PM   #4
YoVivoPorSPORTS
Bat Boy
 
Join Date: Jul 2003
Location: Los Angeles, CA but currently in Putney, VT
Posts: 6
Well I think this may work for getting the height into inches (this is based upon mysql hopefully it works in other sql). I don't know much about sql besides administering databases online but I found this in one of hte books I have.

The modulo operator; evaluates to the remainder of m divided by m % n is the same as MOD(m,n).. As with division, the modulo operator with a divisor of zero returns NULL.

Here is a quote from Sam's MySQL

"The modulo operator; evaluates to the remainder of m dived by m % n is the same as MOD(m,n). As with division, the modulo operator with a divisor of zero returns NULL."

So therefore I think you can do the following

Multiply cm x .39 then divid by 12 and strip anything to the right of the decimal point if one is returned. If you dont have any decimals then it is obviously a nice round number divisible by .39 which is very unlikely. When you do have something that is stripped then you have to take the original number you got after doing the first operation and then use the % to get the remainder which you add on to the original cmx.39 result stripped of the decimals.

c=cm

(cmx.39)/12=a
a (rounded down, stripped of decimals whatever you want to call it or use to get a round number) is the number of feet.

a%12=r
R is the remainder and is the inches number. So therefore you can display as fllows

A feet r inches and then make sure that you put somethign in there so that it does not show anythign for the inches if the remainder comes back as 0 and so that it says inch rather than inches if it is 1.

Some modification will be needed as .39 is NOT an exact conversion factor so you may get a little error and you WILL need to round the inches using whatever method you choose so that you can get what you need, I'd say just round to the nearest whole number .
I hope this helps but as I don't really understand too much of any type of sql and this is from a mysql book I'm not sure it will help but I hope you find it useful and it helps you figure out your conundrum.


FIXED!
__________________
It's called baseball not foosball!

Last edited by YoVivoPorSPORTS; 09-07-2006 at 01:08 AM.
YoVivoPorSPORTS is offline   Reply With Quote
Old 09-14-2006, 01:11 PM   #5
Zubes
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
this doesnt work, dont use it
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 09-22-2006, 04:44 PM   #6
Zubes
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
i stand corrected, this formula will work.

the problem is that all the neccessary info wasnt here that i need to make it work, so i will reclarify it:

$total_inches = 0.3937008*$AR_result[ 'height' ];
$feet = $total_inches/12;
$inches=$total_inches%12;
then to display, all you need is this:

echo floor($feet)."' ".$inches."'';
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 09-22-2006, 04:47 PM   #7
Zubes
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
converting height

$total_inches = 0.3937008*$AR_result[ 'height' ];
$feet = $total_inches/12;
$inches=$total_inches%12;
then to display, all you need is this:

echo floor($feet)."' ".$inches."'';

i got it to work doing this. seems i forgot to strip the decimals and round down the first time, but i stumbled across it the other day, and sicne you had given up on it i had forgotten it.

but thanks for the big step in the right direction.
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 09-22-2006, 04:48 PM   #8
Zubes
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
converting height

big thanks to YoVivoPorSPORTS for intially starting to help me with this. no way i would have gotten this far without it.
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Reply

Bookmarks


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

Forum Jump


All times are GMT -4. The time now is 07:02 AM.

 

Major League and Minor League Baseball trademarks and copyrights are used with permission of Major League Baseball. Visit MLB.com and MiLB.com.

Officially Licensed Product – MLB Players, Inc.

Out of the Park Baseball is a registered trademark of Out of the Park Developments GmbH & Co. KG

Google Play is a trademark of Google Inc.

Apple, iPhone, iPod touch and iPad are trademarks of Apple Inc., registered in the U.S. and other countries.

COPYRIGHT © 2023 OUT OF THE PARK DEVELOPMENTS. ALL RIGHTS RESERVED.

 

Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright © 2024 Out of the Park Developments