我正在寻找php + MySQL + jquery的一些帮助 我有2张桌子
表1 表1有4个colume (id,title,desc,thumb_img)
tabel2 表2有3个colume(id,table1id,img)
我只想将2表与$ _get ['QS']的值进行比较; 并显示两者的记录(title,desc,img)
期待帮助。:)
答案 0 :(得分:2)
SELECT t1.title, t1.desc, t2.img
FROM table1 AS t1
JOIN table2 AS t2
ON t1.id=t2.table1id
WHERE somefieldyoudidntspecify=:qs
答案 1 :(得分:0)
<?php
$query="select * from table1 t1 inner join table2 t2 on t2.table1id = t1.id where SomeField = '". mysql_real_escape_string($_get['QS'])."'"
?>