$sql_As = "SELECT*FROM accessories,province where accessories.province=province.PROVINCE_ID and(id_As like '%$str_As%' or name_As like '%$str_As%' or type_As like '%$str_As%'or amount_As like '%$As' or date like '%$str_As%') order by id_As";//จอยตารางจ้าาาา
$dbquery_As=mysql_query($sql_As);
โค๊ด error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\storeshop\admin\index.php on line 279
SELECT *
FROM accessories, province
WHERE accessories.province = province.PROVINCE_ID
AND (
id_As LIKE '%$str_As%'
OR name_As LIKE '%$str_As%'
OR type_As LIKE '%$str_As%'
OR amount_As LIKE '%$str_As'
OR DATE LIKE '%$str_As%'
)
ORDER BY id_As
LIMIT 0 , 30
MySQL said:
#1054 - Unknown column 'accessories.province' in 'where clause'
SELECT *
FROM accessories, province, amphur
WHERE accessories.name_As = province.PROVINCE_ID
AND accessories.type_As = amphur.AMPHUR_CODE(
id_As LIKE '%$str_As%'
OR name_As LIKE '%$str_As%'
OR type_As LIKE '%$str_As%'
OR amount_As LIKE '%$str_As'
OR DATE LIKE '%$str_As%'
)
ORDER BY id_As
LIMIT 0 , 30
MySQL said:
#1305 - FUNCTION amphur.AMPHUR_CODE does not exist
ELECT*FROM accessories where (id_As like '%$str_As%' or name_As like '%$str_As%' or type_As like '%$str_As%'or amount_As like '%$str_As' or date like '%$str_As%') order by id_As
SELECT * FROM accessories, province, amphur
WHERE accessories.name_As = province.PROVINCE_ID
AND accessories.type_As = amphur.AMPHUR_CODE and (
id_As LIKE '%$str_As%'
OR name_As LIKE '%$str_As%'
OR type_As LIKE '%$str_As%'
OR amount_As LIKE '%$str_As'
OR DATE LIKE '%$str_As%'
)
ORDER BY id_As
LIMIT 0 , 30
----**** น่าจะเป็นประมาณนี้นะค่ะ เพิ่ม and เข้าไปข้างหลัง amphur.AMPHUR_CODE ลองดูนะค่ะ
SELECT *
FROM accessories, province, amphur
WHERE accessories.PROVINCE_ID = province.PROVINCE_ID
AND amphur.AMPHUR_CODE = amphur.AMPHUR_CODE
AND (
id_As LIKE '%$str_As%'
OR PROVINCE_ID LIKE '%$str_As%'
OR AMPHUR_CODE LIKE '%$str_As%'
OR amount_As LIKE '%$str_As'
OR DATE LIKE '%$str_As%'
)
ORDER BY id_As
LIMIT 0 , 30
MySQL said:
#1052 - Column 'PROVINCE_ID' in where clause is ambiguous
SELECT*FROM accessories,province,amphur where accessories.PROVINCE_ID=province.PROVINCE_ID and accessories.AMPHUR_CODE=amphur.AMPHUR_CODE order by id_As
ตอนนี้ ออกแล้วครับ,,,, เดียวต้องทำ LIKE เพิ่ม เพื่อที่จะทำค้นหา >,<