จะ เลือกข้อมูล แล้วมาให้แสดง มันผิดตรงไหนครับ จอยกัน 3 ตาราง ครับ
Code (PHP)
<html>
<head>
<meta charset="utf-8">
<title>report</title>
<style type="text/css" media="txtKeyword" >
input{
display:none;
}
</style>
</head>
<?php
$objConnect = mysql_connect("localhost","root") or die(mysql_error());
$objDB = mysql_select_db("db_package");
mysql_query("SET NAMES UTF8");
?>
<script language="javaScript">
function resutname(Bom_ID)
{
switch(Bom_ID)
{
<?php
$strSQL = "SELECT * FROM bom ORDER BY Bom_ID ASC";
$objQuery = mysql_query($strSQL);
while($objresult = mysql_fetch_array($objQuery))
{
?>
case "<?php echo $objresult["Bom_ID"];?>":
break;
<?php
}
?>
default:
frmSearch.txtname.value="";
}
}
</script>
<body>
<center>
<form name="frmSearch" method="get" action="<?php echo $_SERVER['SCRIPT_NAME'];?>">
<table width="599" >
<tr>
<th>
<select name="txtKeyword" id="txtKeyword" onChange="resutname(this.value);">
<option value="">< - -กรุณาเลือก - -></option>
<?php
$strSQL = "SELECT * FROM bom ORDER BY Bom_ID ASC";
$objQuery = mysql_query($strSQL);
While($objresult = mysql_fetch_array($objQuery))
{
?>
<option value="<?php echo $objresult["Bom_ID"];?>"><?php echo $objresult["Bom_ID"];?></option>
<?php
}
?>
</select>
<input type="submit" value="ตกลง"></th>
</tr>
</table>
<center>
<p style="font-size: 24pt; font-family: 'Gill Sans', 'Gill Sans MT', 'Myriad Pro', 'DejaVu Sans Condensed', Helvetica, Arial, sans-serif;">รายงาน </p>
</center>
<center>
<?php
if($_GET)
{
$objConnect = mysql_connect("localhost","root") or die("Error Connect to Database");
$objDB = mysql_select_db("db_package");
mysql_query("SET NAMES UTF8");
$id3=$_GET['txtKeyword'];
// Search By Name or Email
//$strSQL = "SELECT * FROM products,bom WHERE (Pro_ID LIKE '%".$_GET["txtKeyword"]."%')";
$strSQL = "SELECT package.*,products.*,bom.* FROM package LEFT products ON package.Pro_ID = products.Pro_ID LEFT JOIN bom NO products.Bom_ID = bom.Bom_ID WHERE bom.Bom_ID='$id3'";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="493" height="58" border="1" >
<tr>
<th width="85" height="23"> <div align="center">รหัส </div></th>
<th width="281"> <div align="center">รายการ</div></th>
<th width="105"> <div align="center">รหัส Package</div></th>
</tr>
<?php
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?php echo $objResult["Pro_ID"];?></div></td>
<td><?php echo $objResult["Pro_Name"];?></td>
</tr>
<?php
}
?>
</table>
<p>
<input type="button" value=" พิมพ์ " onClick="print();">
<a href="bom_report.php"><input type="button" name="button2" id="button2" value="ย้อนกลับ"></a>
</center>
<?php
mysql_close($objConnect);
}
?>
<p></p>
<a href="home.html">
<input type="button" name="button" id="button" value="หน้าหลัก">
</a>
<p> </p>
<p> </p>
</form>
</center>
</body></html>
Tag : PHP
Date :
2016-06-24 13:07:33
By :
golfza034
View :
609
Reply :
2
NO มาจากไหนง่าา
Code (PHP)
$strSQL = "SELECT package.*,products.*,bom.* FROM package LEFT products ON package.Pro_ID = products.Pro_ID LEFT JOIN bom NO products.Bom_ID = bom.Bom_ID WHERE bom.Bom_ID='$id3'";
มันต้องเป็น ON เปล่า
Code (PHP)
$strSQL = "SELECT package.*,products.*,bom.* FROM package LEFT products ON package.Pro_ID = products.Pro_ID LEFT JOIN bom ON products.Bom_ID = bom.Bom_ID WHERE bom.Bom_ID='$id3'";
ประวัติการแก้ไข 2016-06-24 16:09:46 2016-06-24 16:09:49
Date :
2016-06-24 16:09:16
By :
progamer2000
Load balance : Server 01