解决方案 »

  1.   

    查询失败了!
    $sql=mysql_query("select * from bg_user where $tj='$key'",$_link) or die(mysql_error());
      

  2.   

    逻辑写反了,if($result!=false)这个该循环输出内容的,你alert了。
      

  3.   

    @flowerfly1988
    还是不行,他一直出现这个
                                      <?php
    if(isset($_POST['search_key'])){
    $tj=$_POST['select_tj'];
    var_dump($tj);
    $key=$_POST['search_key'];
    var_dump($key);
    $sql="select * from bg_user where $tj='$key'";
    $result=mysql_fetch_array($sql); 
    if($result!=false){
    do{
    ?>
    <table border="1" bordercolor="#ccc" width="600" height="400" align="center" cellpadding="0" cellspacing="0">
    <tr width="600" height="40"><td colspan="4" bgcolor="#ccc">用户管理</td></tr>
    <tr width="600" height="40">
    <td width="100">用户名:</td>
    <td><?php echo $result[username];?></td>
    <td width="100">性别:</td>
    <td><?=$result['sex']?></td>
    </tr>
    <tr width="600" height="40">
    <td width="100">邮箱:</td>
    <td><?php echo $result['email'];?></td>
    <td width="100">QQ:</td>
    <td><?=$result['QQ']?></td>
    </tr>
    <tr width="600" height="40">
    <td width="100">个人主页:</td>
    <td colspan="3"><?=$result['homepage']?></td>
    </tr>
    <tr width="600" height="40">
    <td width="100">IP地址:</td>
    <td></td>
    <td width="100">生日:</td>
    <td><?=$result['birthday']?></td>
    </tr>
    <tr width="600" height="150">
    <td width="100">个人照片:</td>
    <td colspan="3"><?=$username?></td>
    </tr>
    <tr width="600" height="40">
    <td width="120">现住城市:</td>
    <td colspan="3"><?=$result['city']?></td>
    </tr>
    <tr width="600" height="40">
    <td width="120">家庭住址:</td>
    <td colspan="3"><?=$result['addr']?></td>
    </tr>
    </table>
    <?php
    }while($result=mysql_fetch_array($sql));
    }else{
    echo "<script>alert('对不起,该用户不存在!');</script>";
    }
    }
    ?>
      

  4.   

    我的sql语句有没有写错$sql="select * from bg_user where $tj='$key'";
      

  5.   

    #3中
    $sql="select * from bg_user where $tj='$key'";
    $result=mysql_fetch_array($sql); 
    缺少 mysql_query($sql);
    不查询,哪来的结果既然是用 mysql 函数族,为何#5截图中是 mysqli_query 出错?
      

  6.   

    @xuzuning
    加了 mysql_query($sql),
    但出现这种错误
      

  7.   

    没有名为“用户名”的列<select name="sel_tj" id="sel_tj">
    <option value='用户名对应的列名'>用户名</option>
    </select>