HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Spanning two UL's
Post new topic   Reply to topic    HTML Help Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Abstract X UK



Joined: 08 Jun 2007
Posts: 127
Location: United Kingdom

PostPosted: Mon Sep 22, 2008 5:16 am     Spanning two UL's Reply with quote

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

PostPosted: Mon Oct 06, 2008 6:18 am     Reply with quote

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>";
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> PHP All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial