473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dynamic Data Layout

Hi there,

I apologise if I'm posting in the wrong section - I Have absolutely no idea how my problem is resolved.

I have a recordset that queries my SQL data base the the results are displayed in a list - all normal so far.

What I want is insert a line between all the products that my SQL query displays and/or have each one in an alternative coloured background.

How is this done?
Thanks for any help given!
Nov 18 '08 #1
5 2346
serdar
88
It's very easy if I get it correct. The proper HTML element to use should be a list (ul for unordered lists).

You can style you list with CSS (Insert margins between lits items, change backgrounds etc.).

For alternative background colors you may use classes. Here is an example:
[HTML]<ul>
<li class="odd">item 1</li>
<li class="even">item 2</li>
<li class="odd">item 3</li>
</ul>[/HTML]

Styles for classes above:
Expand|Select|Wrap|Line Numbers
  1. odd {background:#ccc;}
  2. even {background:#ddd;}
Nov 18 '08 #2
Thanks for the post serdar but styling is pages is really not my strong point and um unsure how to implement your code into my Sql results.

Can you please elaborate on how I insert lines between my results.

Thanks once again.
Nov 19 '08 #3
serdar
88
Okay, which scripting language (PHP, ASP, JSP, etc.) are you using to query your database?
Nov 19 '08 #4
Hi, Im using PHP in dreamweaver CS3
Nov 19 '08 #5
serdar
88
Here is a sample php script, upload it to your server and test:

[PHP]<?php

//this is a sample result set, you should replace it with your SQL query results
$results=array("result 1", "result 2", "result 3", "result 4", "result 5");

$odd=true;

foreach ($results as $r) {
if ($odd) {$listClass='odd';}
else {$listClass='even';}
$odd=!$odd;
$list.='<li class="'.$listClass.'">'.$r.'</li>';
}

?>

<html>
<head>
<style>
li {margin:10px 0;}
.odd {background:#ccc;}
.even {background:#ddd;}
</style>
</head>
<body>
<ul>
<?php echo $list; ?>
</ul>
</body>
</html>[/PHP]
Nov 19 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Devon | last post by:
Hi All, I'm generating a pdf document using FOP .25 from Apache. I've created running dynamic headings (e.g. chapter titles) that change as dictated by the XML source I'm converting to PDF. Now...
6
by: Paul | last post by:
Hi I have 2 data grids and several controls on a web page. The grids will vary in size, just wondering if the lower grid could be covered by part of the upper grid depending on its size or is there...
1
by: LilC | last post by:
I'm creating an application that has a standard layout for all pages. The information that is displayed in the layout will be dynamic based on the user that is logged in. Thus when a page is...
11
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
0
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all...
9
by: dli07 | last post by:
Hello, I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from...
1
by: Gurur | last post by:
Hi all, I have a doubt. If I have 2 structures and one is parent of other , ie the child structure is present in the parent one . And if the child structure is declared as dynamic array in the...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
14
by: vivek | last post by:
i have some doubts on dynamic memory allocation and stacks and heaps where is the dynamic memory allocation used? in function calls there are some counters like "i" in the below function. Is...
2
by: Peted | last post by:
Can anyone suggest a best practice approach to building a dynamic winforms UI. Just as an example somehting like a billing application where you enter a customer billing data and the billing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.