Reputation: 47
I am looking some help in php+MySQL+jquery I have 2 tables
table1 table 1 have 4 colume (id, title, desc, thumb_img)
tabel2 table 2 have 3 colume(id, table1id, img)
I just want to compare 2 table with the value of $_get['QS']; and show the records from both (title, desc, img)
Looking forward for the help.:)
Upvotes: 2
Views: 1230
Reputation: 11987
<?php
$query="select * from table1 t1 inner join table2 t2 on t2.table1id = t1.id where SomeField = '". mysql_real_escape_string($_get['QS'])."'"
?>
Upvotes: 0
Reputation: 798536
SELECT t1.title, t1.desc, t2.img
FROM table1 AS t1
JOIN table2 AS t2
ON t1.id=t2.table1id
WHERE somefieldyoudidntspecify=:qs
Upvotes: 2