Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question
1  
do you just need to join these together to get the results? – Randy Jun 19 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. – Mike 'Pomax' Kamermans Jun 19 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 – Php developer Jun 19 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? – Mark Bannister Jun 19 at 13:14

1 Answer

up vote 1 down vote accepted
select title, image, list
from title t, image i, list l
where t.id = i.id
and t.id = l.id
share|improve this answer
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. – Php developer Jun 19 at 13:13
i suggest editing your original question with some expected output. – Randy Jun 19 at 14:13
yeah I used join with some extra features and now its working fine. thanks a lot its working. – Php developer Jun 22 at 5:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.