select * from table where 食品='Y1' AND 价格='Z1'

解决方案 »

  1.   

    <?php
    $conn=ocilogon("xx", "xx", "xx");
    $sql="select * from table where 食品='Y1' AND 价格='Z1'";
    $stmt=ociparse($conn,$sql);
    ociexecute($stmt);
    while(ocifetch($stmt))
      {
      $result =  ociresult($stmt, "table");
      echo $result;
      }
    ?>
    我是这样用的,但出错了,请问错在哪里呢?
      

  2.   

    食品='Y1' AND 价格='Z1'
    你怎么知道是Y1和Z1呢?应该以变量的形式传入才行啊
      

  3.   

    页面的下拉列表框X1:
    <select name="X1">
      <option selected value='1'>苹果</option>
      <option value='3'>葡萄</option>
    </select>
    在.php程序里就直接用$X1
      

  4.   

    <form action="action.php" method="POST">
     <select name="X1">
      <option selected value='1'>苹果</option>
      <option value='3'>葡萄</option>
     </select>
     <input type="submit">
    </form>
    action.php:
    $stmt = OCIParse($conn,"select  *  from table where 水果=$X1");//error
    $stmt = OCIParse($conn,"select  *  from table where 水果='X1'");//right