怎么查找我输入的值属于某个范围?

WBOY
Release: 2016-06-06 20:28:03
Original
1366 people have browsed it

公司要做个根据用户输入 身高 体重 来推荐尺码的工具
公司给我提供了一张参考表,如下:
怎么查找我输入的值属于某个范围?

比如说我输入自己的身高体重
该程序就会把对应的尺码推荐给我
例如:身高120cm 体重24公斤 那么我就应该属于130的尺码

我是PHP入门级别的开发人员
该问题不知道如何下手...
想请教大神们
这样的功能需求如何建表?建几个表?怎么查询?
如何筛选一个数字属于哪个范围之内?

万分感谢!
盼复!

回复内容:

公司要做个根据用户输入 身高 体重 来推荐尺码的工具
公司给我提供了一张参考表,如下:
怎么查找我输入的值属于某个范围?

比如说我输入自己的身高体重
该程序就会把对应的尺码推荐给我
例如:身高120cm 体重24公斤 那么我就应该属于130的尺码

我是PHP入门级别的开发人员
该问题不知道如何下手...
想请教大神们
这样的功能需求如何建表?建几个表?怎么查询?
如何筛选一个数字属于哪个范围之内?

万分感谢!
盼复!

数据量不是很大,没必要放到数据库里面,用一个数组保存数据就行了

<code>function get_size($hight,$weight){
    $array=array(100=>array('height'=>array(0,95),'weight'=>array(0,15)),110=>array());
    $size = 150;
    foreach($array as $key=>$value){
        if($hight >=$value['height'][0] and $hight =$value['weight'][0] and $weight </code>
Copy after login

$array我写的是伪码,你自己补充一下

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!