This is probably an easy question but does anyone know how to insert data from a database into tabs autonomously ordered by a certain field?
Let me clarify, I need each tab to display data from my database ordered by the date they were added. So the latest in tab 1, the next in tab 2, and so on.
I've had this working in an accordion style where I did the database query first with a limit of five which repeated my code that inserted the info from the database up to five times. I have been trying to figure out a way similar to this except with tabs instead. Even if I could get a database query to put the latest result in tab 1, then do another query in tab 2 to find the second newest result, and so on.
Thanks for your time. Sorry if this is a silly question. :)
Sorry for leaving out code. What I am hoping to do is to call data from a database with code simular to
<?php
$subject_set = mysql_query("Select * FROM database WHERE column1 like 'value' ORDER BY date_added DESC LIMIT 4", $connection);
if (!$subject_set){
die("Database connection failed: " . mysql_error());
}
while ($subject = mysql_fetch_array($subject_set)){?>
<ul class="tab-links">
<li class="active"><a href="#tab-1">Tab #1</a></li>
<li><a href="#tab-2">Tab #2</a></li>
<li><a href="#tab-3">Tab #3</a></li>
<li><a href="#tab-4">Tab #4</a></li>
</ul>
<div class="tab-content">
<div id="tab-1" class="tab active">
<?=$subject['column1']?>
<?=$subject['column2']?>
<?=$subject['column3']?>
<?=$subject['column4']?>
</div>
<div id="tab-2" class="tab">
<?=$subject['column1']?>
<?=$subject['column2']?>
<?=$subject['column3']?>
<?=$subject['column4']?>
</div>
<div id="tab-3" class="tab">
<?=$subject['column1']?>
<?=$subject['column2']?>
<?=$subject['column3']?>
<?=$subject['column4']?>
</div>
<div id="tab-4" class="tab">
<?=$subject['column1']?>
<?=$subject['column2']?>
<?=$subject['column3']?>
<?=$subject['column4']?>
</div>
</div>
I was hoping for code similar to this or probably only have one tab which is repeated depending on the limit in the database query.