「select」語句 該陣列包含以下字符串 陣列 ( [0] => MAJINNA [1] => K.DHANA RAJU [2] => B.EPHRIM ) 陣列數據已經從以下數據內爆在類
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<style>
table{
\t border : 1px solid black;
}
tr{
\t border : 1px solid black;
}
td{
\t border : 1px solid black;
}
</style
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Update Deployement</title>
<style type="text/css">
body
{
background-color: #00FF00;
background-image: url(images/gail-india.jpg);
color: #000000;
scrollbar-face-color: #0B0B0B;
scrollbar-arrow-color: #C8C8C8;
scrollbar-3dlight-color: #0B0B0B;
scrollbar-darkshadow-color: #000000;
scrollbar-highlight-color: #141414;
scrollbar-shadow-color: #060606;
scrollbar-track-color: #0B0B0B;
}
</style>
</head>
<body>
<form method="post" action="edit_data.php">
<div id="wb_Image3" style="margin:0;padding:0;position:absolute;left:7px;top:4px;width:208px;height:129px;text-align:left;z-index:0;">
<img src="images/image_thumb3.png" id="Image2" alt="" border="0" style="width:208px;height:129px;"></div>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("gail", $con);
$installation_1 = trim($_POST['installation']);
$area_1 = trim($_POST['area']);
$district_1 = trim($_POST['district']);
if(empty($area_1) AND empty($district_1))
{
$sql = "SELECT * FROM deployment WHERE installation ='" . $installation_1 . "'";
}
else if(empty($installation_1) AND empty($district_1))
{
$sql = "SELECT * FROM deployment WHERE area ='" . $area_1 . "'";
}
else if(empty($installation_1) AND empty($area_1))
{
$sql = "SELECT * FROM deployment WHERE district ='" . $district_1 . "'";
}
else if(empty($district_1))
{
$sql = "SELECT * FROM deployment WHERE installation ='" . $installation_1 . "' AND area ='" . $area_1 . "'";
}
else if(empty($area_1))
{
$sql = "SELECT * FROM deployment WHERE installation ='" . $installation_1 . "' AND district ='" . $district_1 . "'";
}
else if(empty($installation_1))
{
$sql = "SELECT * FROM deployment WHERE area ='" . $area_1 . "' AND district ='" . $district_1 . "'";
}
else
{
$sql = "SELECT * FROM deployment WHERE installation ='" . $installation_1 . "' AND area ='" . $area_1 . "' AND district ='" . $district_1 . "'";
}
$result = mysql_query($sql);
echo "<table id='table1' width = '500' align = 'center' style= 'border:1px'>";
\t echo "<tr><b>";
\t \t echo "<td>Installation</td>";
\t \t
\t \t echo "<td>Area</td>";
\t \t echo "<td>District</td>";
\t \t
\t \t echo "<td>Employee Name</td>";
echo "<td>Reference</td>";
\t \t
\t \t echo "</b></tr>";
$employee = array();
\t
while($row = mysql_fetch_array($result))
\t {
\t \t echo "<tr>";
\t \t echo ("<td>$row[installation]</td>");
echo ("<td>$row[area]</td>");
echo ("<td>$row[district]</td>");
echo ("<td>$row[employeename]</td>");
echo ("<td>$row[ref]</td>"); \t
\t \t echo"</tr>";
\t \t $employee[] = $row['employeename'];
\t \t $arrlength = count($employee); \t
\t }
\t echo"</table>";
\t echo '<pre>'; print_r(array_filter($employee)); echo '</pre>';
?>
</body>
</html>
來到現在我正像這樣的錯誤:你的SQL語法有錯誤;檢查對應於您的MySQL服務器版本的手冊,以便在第1行 處使用「'MAJINNA,K.DHANA RAJU,B.EPHRIM''附近的正確語法請給我任何建議,提前致謝 注意:我不能使用員工編號代替員工姓名,由於客戶端的請求
代碼
<?
$emp = implode(',', $employee);
echo '<pre>'; print_r($emp); echo '</pre>';
$sql = "SELECT * FROM securitystaffdetails WHERE employeename IN '" . $emp . "'";
$result = mysql_query($sql) or die(mysql_error());
echo "<table id='table1' width='1500' style= 'border:1px'>";
\t echo "<tr><b>";
\t \t echo "<td>Employee Name</td>";
\t \t
\t \t echo "<td>Address</td>";
\t \t echo "<td>DOB</td>";
\t \t
\t \t echo "<td>Age</td>";
echo "<td>SEx</td>";
\t \t echo "<td>Mobile Number</td>";
\t \t echo "<td>Blood Group</td>";
\t \t echo "<td>ID Card</td>";
\t \t echo "<td>Ex Army Idcard</td>";
\t \t echo "<td>Police Clearence</td>";
\t \t echo "<td>ESI Card</td>";
\t \t echo "<td>PF Account</td>";
\t \t echo "<td>PAN Card</td>";
\t \t echo "<td>Voter ID</td>";
\t \t echo "<td>Ration/Family</td>";
\t \t
\t \t echo "</b></tr>";
$employee = array();
\t
while($record = mysql_fetch_object($result))
\t {
\t \t echo "<tr>";
\t \t echo ("<td>$record[employeename]</td>");
echo ("<td>$record[address]</td>");
echo ("<td>$record[dob]</td>");
echo ("<td>$record[age]</td>");
echo ("<td>$record[sex]</td>");
\t \t echo ("<td>$record[mobn]</td>");
\t \t echo ("<td>$record[bg]</td>");
\t \t echo ("<td>$record[icard]</td>");
\t \t echo ("<td>$record[exarmycard]</td>");
\t \t echo ("<td>$record[policeclearence]</td>");
\t \t echo ("<td>$record[esicard]</td>");
\t \t echo ("<td>$record[pfa]</td>");
\t \t echo ("<td>$record[pancard]</td>");
\t \t echo ("<td>$record[acard]</td>");
\t \t echo ("<td>$record[vcard]</td>");
\t \t echo ("<td>$record[rcard]</td>"); \t
\t \t echo"</tr>";
\t \t
\t }
\t
\t echo"</table>";
?>
,你破滅的員工姓名前,報價每一個第一,那你爆 – Ghost 2015-02-24 08:42:09