Jump to content

search on range of heights not working


vikaspa

Recommended Posts

visit

 

http://bhavbandh.com/admin/subscriber_search1.php

this is matrimonial web site

 

and search is not working properly give height range as

 

5 to 5.5

following query is executed

 

SELECT * FROM data1 WHERE ( height >=5 and height <= 5.5) order by surname, firstname

 

which I feel is correct

 

however the reult is not correct

 

I found following entry erroneous

 

G01457 Nevalkar Mihir  32930621/ 9323211402 mihir.newalkar@gmail.com

Groom 27 Yrs.

1981-11-19 5.11 Gautam

 

Before concluding pls let me  tell you that data was originally in excel sheet

and height was specified as

 

5'05"

6'01"

5'11"

5'10"

5'08"

5'11"

5'10"

5'04"

5'11"

5'06"

 

I derived height as follow : (height is stored in data[21] )

 

list($ft, $in) = split('[\"\']',$data[21]);

$height= $ft+($in/100) ;

 

and filed is defined as

  height decimal(10,2)  Yes NULL

 

please help me to reolve this

Link to comment
Share on other sites

The script is working as intended, you have to realize that converting foot/inches height into decimals does not work that well.

 

5'11" to decimal is 5.11 which is clearly lower than 5.5 and higher than 5.0

 

Possible solutions would be creating two separate columns in the DB, one for feet and one for inches and sort by feet then inches. Or a more ugly approach is check if the $in variable is less than 10, and in that case divide it by 1000 rather than by 100. Not too sure about that though... You'd have to re-format them again when displaying them.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.