List:General Discussion« Previous MessageNext Message »
From:Christopher R. Jones Date:July 26 2000 9:16pm
Subject:Re: Height problem, stored as feet and inches.
View as plain text  
I don't know PHP but a crude perl script that converts:  
#!/usr/bin/perl -w

use strict;

my $feet1 = qq(3'9");
my $feet2 = qq(13'11");

my $feet;
my $inches;

my $totalinches;

($feet,$inches) = split("'", $feet1);
$inches =~ s/\"//g;
$totalinches = $feet*12 + $inches;

print "$feet, $inches: $totalinches\n";

($feet,$inches) = split("'", $feet2);
$inches =~ s/\"//g;
$totalinches = $feet*12 + $inches;

print "$feet, $inches: $totalinches\n";



>I am currently working ona database that has a PHP front end and is fully
>searchable.  Everything is working except the height field searches.  I was
>handed this database as is, and did not do the design, and the height filed
>is entered as a a CHAR in the format of 3'9 for example.  I would have
>prefered to do it as INT of number of inches for easier searches.  Does
>anyone know of a way I can search for a height range, such as 3'5" to 8'7",
>in the current format?  Or maybe a loop that goes through the database and
>adds a new field as inches and converts the strings to ints in the new
>field? My database experience is minimum, I am trying to learn, but this
>part has me stumped.  Any help would be appreciated!
>
>Mike Kriz
>Kriz Design
>mike@stripped
>www.krizdesign.com
>
>
>
>-- 
>---------------------------------------------------------------------
>Please check "http://www.mysql.com/php/manual.php" before
>posting. To request this thread, e-mail mysql-thread45566@stripped
>
>To unsubscribe, send a message to:
>     <mysql-unsubscribe-cj=interlog.com@stripped>
>
>If you have a broken mail client that cannot send a message to the above
> address(Microsoft Outlook), you can use http://lists.mysql.com/php/unsubscribe.php


Christopher R. Jones, P.Eng.
14 Oneida Avenue
Toronto, Ontario M5J 2E3
Tel. 416 203-7465
Fax. 416 203-3044
Email cj@stripped


Thread
Height problem, stored as feet and inches.Crisis26 Jul
  • Re: Height problem, stored as feet and inches.Jeremy Cole26 Jul
    • Re: Height problem, stored as feet and inches.Jim Allen26 Jul
  • Re: Height problem, stored as feet and inches.Christopher R. Jones26 Jul
  • Re: Height problem, stored as feet and inches.Rolf Hopkins27 Jul
    • Re: Height problem, stored as feet and inchesAndrew Lowe27 Jul
    • Re: Height problem, stored as feet and inches.Ryan Wahle27 Jul
Re: Height problem, stored as feet and inchesNick Lindridge27 Jul