$sql="SELECT * FROM tb_company WHERE year='2556' ";
$query=mysql_query($sql) or die (mysql_error());
//echo $sql;
while($result=mysql_fetch_assoc($query)){
<a href="select_asset.php?select=<?=$result["code_company"];?>&&year=<?=$result["year"];?>&&company=<?=$result["company_name"];?>"><?=strtoupper($result["code_company"]);?></a>
}
<?
if($objquery){
echo"Updated.";
$sql_back="SELECT * FROM tb_asset ";
$query_back=mysql_query($sql_back) or die (mysql_error());
while($result_back=mysql_fetch_assoc($query_back)){
header( "location:select_asset.php?select=$result_back[code_company]&year=$result_back[year]&company=$result_back[company_name]" );
exit(0);
}
}else{
echo"Not Update ";
}
}
?>
รับค่าแสดงผลที่รับค่า $_GET มา Code (PHP)
<?
//$sql="SELECT * FROM tb_asset WHERE owner='$_GET[select]' AND year='$_GET[year]' ";
//$sql="SELECT * FROM tb_asset WHERE owner='$_GET[select]' AND year='$_GET[year]' AND company='$_GET[company_name]' ";
$sql= "SELECT tb_company.*,tb_asset.* FROM tb_company,tb_asset WHERE owner='$_GET[select]' AND year='$_GET[year]' AND company='$_GET[company]' ";
$query = mysql_query($sql) or die ("Error Query = ".$sql." ");
echo $sql;
$no =1;
while($result=mysql_fetch_assoc($query)){
?>
Code (PHP)
Error Query = SELECT tb_company.*,tb_asset.* FROM tb_company,tb_asset WHERE owner='tva' AND year='2556' AND company='[TVA] Toscana Valley Archiscape Co,.Ltd'
ลอง Query ดูใน sql มันแจ้งแบบนี้ Code (PHP)
Error
SQL query: Documentation
SELECT tb_company. * , tb_asset. *
FROM tb_company, tb_asset
WHERE owner = 'tva'
AND year = '2556'
AND company = '[TVA] Toscana Valley Archiscape Co,.Ltd'
LIMIT 0 , 30
MySQL said: Documentation
#1052 - Column 'year' in where clause is ambiguous