1

I have three tables namely title, image, lists. title table has an auto_increment id which is present in other two tables as reference id, other than that these two has their own auto_increment pid and lid, i want to fetch record from all tables using while loop.

eg.
my title table has

id   title
1    nirman
2    meditation

my image table has

pid   id  image
1     1    1.jpg
2     1    2.jpg
3     2    6.jpg

and my list table has

lid   id   list
1     1    serve us....
2     1    web service
3     1    cms
4     2    about

i have different division to show all data from image and list table where heading is coming from title table. If you can understand what I am trying to ask then please reply with relevant code otherwise reply with the part of my text you could not understand.

4
  • 1
    do you just need to join these together to get the results? Commented Jun 19, 2013 at 13:05
  • Let the storage engine deal with that. Select the data from all three tables at the same time based on the id. Commented Jun 19, 2013 at 13:08
  • yeah i did that but the place where I have to show the result is so much complicated that join is not working properly. sorry to say but join is not working fine for me please provide with another alternative Commented Jun 19, 2013 at 13:08
  • 1
    "the place where I have to show the result is so much complicated that join is not working properly" - this makes no sense; displaying it in PHP will not affect the join at all. What did you actually mean? Commented Jun 19, 2013 at 13:14

1 Answer 1

1
select title, image, list
from title t, image i, list l
where t.id = i.id
and t.id = l.id
Sign up to request clarification or add additional context in comments.

3 Comments

a static jquery code was used where multiple images under one title was shown now i replaced that code with php but its not working properly.
i suggest editing your original question with some expected output.
yeah I used join with some extra features and now its working fine. thanks a lot its working.

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.