tags:

views:

45

answers:

2

hi all, 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.:)

+2  A: 
SELECT t1.title, t1.desc, t2.img
FROM table1 AS t1
JOIN table2 AS t2
  ON t1.id=t2.table1id
WHERE somefieldyoudidntspecify=:qs
Ignacio Vazquez-Abrams
somefieldyoudidntspecify? can u explan this?
faisal
It's whatever you want to compare `$_GET['QS']` with.
Ignacio Vazquez-Abrams
A: 
<?php  
   $query="select * from table1 t1 inner join table2 t2 on t2.table1id = t1.id where SomeField = '". mysql_real_escape_string($_get['QS'])."'"
?>
nathan gonzalez
wht is SomeField ?
faisal
@faisal: Perhaps only you can answer that. :) You need to specify what you want to compare against $_get['QS']
Arafangion
yeah, just replace somefield with one of your table fields. you just didn't specify which field should be compared against, so i made up a fake one.
nathan gonzalez