如果我输入一个值,系统将正常运行。问题是,当我输入多个值时,系统不显示任何输出。我需要用户可以批量输入数据并用空格分隔。我的代码有问题吗?
$studid = clean($_POST['studid']);
$studid2 = $studid;
$studid3 =explode(' ',$studid2);
require("php/conn.php");
$sql=mysql_query("SELECT id,studid,name from student where studid in('". implode(',', $studid3)."') group by studid,name");
echo"
<table>
<thead><tr><th>NAME</th><th>IC NUMBER</th><th>ADDRESS</th><th>PHONE NUMBER</th><th>SOURCE</th></tr></thead><tbody>";
if(mysql_num_rows($q) > 0)
{
while($row=mysql_fetch_array($q))
{
echo"
<tr>
<td>".$row['nama']."</td>
<td>".$row['nokp']."</td>
<td>".$row['alamat2']."</td>
<td>".$row['notel2']."</td>
<td>".$row['info']."</td>
</tr>";
}
echo "</tbody></table></div>";
}
答案 0 :(得分:0)
$studid4 = "'" . implode("','", $studid3) . "'";