 |
HTML Help Please Search for the answer to your question before asking it! Thanks.
|
| View previous topic :: View next topic |
| Author |
Message |
Abstract X UK
Joined: 08 Jun 2007
Posts: 127
Location: United Kingdom
|
| Posted: Mon Sep 22, 2008 5:16 am Spanning two UL's |
|
|
Hey all, bear with me whilst i try to explain this!
I have two <ul> lists that are to be populated with data from a MySQL database.
The <ul>'s sit side-by-side.
I wish to create a script that will build these so that they are both equal (or one has 1 fewer if the total is an odd number).
So I was thinking of using a COUNT to count the total of entries in the table.
Dividing that value in half and building the two <ul>'s.
However, I'm not sure how to do it! Many thanks in advance :] |
|
|
coberr
Joined: 28 Feb 2007
Posts: 29
|
| Posted: Mon Oct 06, 2008 6:18 am |
|
|
Take a look at MySQL for advanced help.
A tip for you:
$mod = mysql_select ("Select Count($my_retrieve) from My_Table Where... ");
if (($mod % 2) == 1) {
$mod += 1;
}
$mod = $mod / 2;
$query = mysql_select("Select * from My_Table Where... ");
echo "<table><tr><td><ul>";
for ($i=0; $i<$mod; $i++) {
echo "<li>".$query_retrieved[$i]."<br>\n";
}
echo "</ul></td><td><ul>";
// This loop is till the end of retrieved data
while ($query_retrieved) {
echo "<li>".$query_retrieved."<br>\n";
}
echo "</ul></td></tr></table>"; |
|
|
| |
|
|
|
Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group
|