invisibled wrote:whatever works i'm happy with! haha
Ok basicly i am listing a grid of images that link to a wordpress page. So when the user makes a new page, it will send all the normal wordpress data to the normal wordpress ti_post table and then to my ti_thumb table, witch stores the file name of the image he uploads.
The grid, showing all the pages will look like this
__________________
| |
| |
| ( + ) |
__________________
Page title
So it needs to grab the thumbnail from ti_thumb and the page title and page ID from the ti_post table. Make sence?
I understand what you are trying to do, but you still havent told me how the image thumbnail is related to the post. What is the similar ID between the two? Generally you'll have a database like so:
TABLE: Thumbnail
---------------------
Thumbnail_ID
Image_Path
---------------------
TABLE: Posts
---------------------
Post_ID
Post_Contents
Thumbnail_ID
---------------------
You see? The row from the Posts table would reference one of the thumbnails. So, if we know the ID of the thumbnail we are supposed to use, you can search the thumbnail table to find the path to the image. The relationship is the Thumbnail_ID on both tables. We can use a simple JOIN to get you going. However, if there is no relationship between the image and the post, how are we (or you) supposed to know which thumbnail goes with each post in your image grid?
In my example above, you could do a SQL query like:
SELECT * FROM Posts as p, Thumbnail as t WHERE p.Thumbnail_ID = t.Thumbnail_ID
You would get a result row consisting of:
---------------------
Post_ID
Post_Contents
Thumbnail_ID
Image_Path
---------------------
Then you would only need 1 condition (which is allowed) in your while loop.