如何以相等的值写入选择查询

时间:2016-04-13 04:52:58

标签: php php-5.5

$ values = AEO94 AEO96,如何写入选择查询t_assign_to == $ values;我不知道该怎么做

<?php
include("dbconfig.php");                  
$sql=mysql_query("SELECT * FROM task_employee WHERE emp_underon ='2'");
$count = mysql_num_rows($sql);//2
while($row=mysql_fetch_assoc($sql)){
$values=$row['emp_id'].'<br>';// i got value here like this
//AEO94 
//AE066
    if($count > 0){
    //$mysql = mysql_query("SELECT * FROM task WHERE t_assign_to='$values'")    
    echo $count;
    }else{
    echo "0 results";
    }
}

?>

1 个答案:

答案 0 :(得分:0)

我看到小问题

//$values=$row['emp_id'].'<br>';// html tag is attached to value
$values = $row['emp_id'];// remove br tag 

在条件

之前添加

查询:$ mysql = mysql_query(&#34; SELECT * FROM任务,其中t_assign_to =&#39; $ values&#39;&#34;);