2

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.:)

1

2 Answers 2

2
SELECT t1.title, t1.desc, t2.img
FROM table1 AS t1
JOIN table2 AS t2
  ON t1.id=t2.table1id
WHERE somefieldyoudidntspecify=:qs
Sign up to request clarification or add additional context in comments.

2 Comments

somefieldyoudidntspecify? can u explan this?
It's whatever you want to compare $_GET['QS'] with.
0
<?php  
   $query="select * from table1 t1 inner join table2 t2 on t2.table1id = t1.id where SomeField = '". mysql_real_escape_string($_get['QS'])."'"
?>

2 Comments

@faisal: Perhaps only you can answer that. :) You need to specify what you want to compare against $_get['QS']
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.