Right, it's hard to explain, but I'll try my best.
Litterally, I have a 'tab' box on my homepage.
And a table called 'news'. Now, the table has the rows "shorttitle" "shortstory" and "image" in it.
I want the title the three latest titles to be on the three tabs, and the story and image in the respective content areas. (The table auto increments the ID, and so order by ID descending limit of 3 yes?)
Now, the code for the tabs is:
<?php
$query = "SELECT * FROM news where published = '1' ORDER by id DESC LIMIT 3";
$row_news = mysql_fetch_array($query);
?>
<div id="myTabs">
<ul>
<li><a href="#firsttab"></a><? echo $row_news['shorttitle']; ?></li>
<li><a href="#secondtab">newsID2</a></li>
<li id="last"><a href="#thirdtab">newsID3 </a></li>
</ul>
<div id="firsttab" class="tab_content">
<div class="rafat">
<img src="<? echo $row_news['image']; ?>" />
<p> <? echo $row_news['shortstory']; ?> </p>
</div>
</div>
<div id="secondtab" class="tab_content">
<div class="rafat">
<img src="newsIMAGE2" />
<p> newsSTORY2 </p>
</div>
</div>
<div id="thirdtab" class="tab_content">
<div class="rafat">
<img src="newsIMAGE3" />
<p> newsSTORY3 </p>
</div>
</div>
</div>
Now, i've filled in the first tab with the MYSQL queries, but i'm unsure how to fill in the other two, because of the way it's coded.. I can't do a 'repeating' code, because of the IDs of the divs, and the three tabs are bunched together..
Anyone any ideas?
Much apreciated.
Thanks
Luke