select * from cp where jg between  $a and $b

解决方案 »

  1.   

    用explode把输入的100-200分成$a=100和$b=200这两个数.
    然后用 select * form cp where jg='$a' or jg='$b'
      

  2.   

    查100语句FROM `数据库表名称` WHERE 1 AND `序号字段(一般为id)` = 100 查200语句FROM `数据库表名称` WHERE 1 AND `序号字段(一般为id)` = 200 
      

  3.   

    查100语句SELECT   FROM `数据库表名称` WHERE 1 AND `序号字段(一般为id)` = 100 查200语句SELECT  FROM `数据库表名称` WHERE 1 AND `序号字段(一般为id)` = 200
      

  4.   

    explode把输入的100-200分成$a=100和$b=200这两个数.
    能具体点吗?
    explode????
      

  5.   

    $arr = explode("-","100-200");
    $a=$arr[0];
    $b=$arr[1];
      

  6.   

    $oldstring="100-200";
    $newstring=explode("-",$oldstring);
    $a=$newstring[0];
    $b=$newstring[1];
     if ($a>($a+$b)/2)
       { max=$a;
         min=$b;
      }
     else{
       min=$b;
       max=$a;
    } selecet xxx
      from xx
     where xx<=max and xx>=min
    这样写对不对?
      

  7.   

    <?php
    $oldstring="100-200";
    $newstring=explode("-",$oldstring);
    $a=$newstring[0];
    $b=$newstring[1];if ($a>$b){ 
      $sql="selecet xxx from xx where xx<=$a and xx>=$b";
    }else if($a==$b){
    $sql="selecet xxx from xx where xx='$a'";
    }else{
    $sql="selecet xxx from xx where xx<=$b and xx>=$a";
    }echo $sql;
    ?>
      

  8.   

    //分解字符串,如果你是要找这两个数据的话
    $oldstring="100-200";
    $newstring=explode("-",$oldstring);
    $a=$newstring['0'];
    $b=$newstring['1'];
    $sql="select * from cp where XX='$a' or XX='$b'";//如果是要找他们之间的东东
    $sql="select * from cp where XX between  $a and $b";