473,405 Members | 2,294 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,405 software developers and data experts.

Array information into 2 cells instead of 1?

ok.. subject may not have been clear. I have an array that is being
split - each line into 2 areas. Those 2 areas of each line will take
up one table cell, i.e.:

<TD>$item1 $item2</TD>

So far, so good. Now, when pulling from my db.. I have many lines (100
so far.. soon to be more), I want to have 2 cells so the page fills a
bit more.. how do I set it to put line 1 info in cell 1, line 2 info
in cell 2, and go back & forth between through the db?

foreach $i (@indata)
{chomp($i);

($sponsor,$other) = split(/\|/,$i);
if ($other eq "")
{$add = "";
$add2="";}
else
{$add = "<SPAN CLASS=\"ltblue2\">";
$add2 = "</SPAN>";}

print "<TR>\n";
print "<TD CLASS=\"ltblue\">$sponsor $add$other$add2</TD><TD
CLASS=\"ltblue\">$sponsor$add$other$add2</TD>\n";
print "</TR>\n";}

what should change to make cell 2 have the info that currently goes
to row 2 (as it is.. it just repeats the same db line of info in both
cells.. obviously <G> )

tia,
-L
Jul 19 '05 #1
2 1422
Laurey wrote:
how do I set it to put line 1 info in cell 1, line 2 info
in cell 2, and go back & forth between through the db?
Simply use a couple of extra check variables. Suggested additions and
changes below is an example.

my $cnt = 0;
my $tot = @indata;
my $odd = $tot % 2;
my $col = 0;
foreach $i (@indata)
<snip>
$add2 = "</SPAN>";}

$col = $col == 1 ? 2 : 1;
$cnt++;

print "<TR>\n" if $col == 1;
print "<TD CLASS=\"ltblue\">$sponsor $add$other$add2</TD>";
print "<TD></TD>\n</TR>\n" if $odd and $cnt == $tot;
print "\n</TR>\n" if $col == 2;}
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #2
On Fri, 30 Jan 2004 01:27:30 GMT, Gunnar Hjalmarsson
<no*****@gunnar.cc> wrote:

*snip*

Simply use a couple of extra check variables. Suggested additions and
changes below is an example.

*snip*

BEAUTIFUL!

worked perfectly, thank you Gunnar! you have become my hero for the
month!
-L
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Desperate | last post by:
I want to create class Matrix which contains array of class Rows and some additions Class Rows contains array of Cells Here is the declaration public class Cell public int value = 0...
5
by: Lee | last post by:
Hi All, My problem is trying to figure out how to get the numbers from a range of cells in Excel into an array (double) in a VB.NET program, do something with the array, and then send it back to...
8
by: Ben | last post by:
Hi, I am having trouble debugging a segmentation fault...here's my data structure: typedef struct CELL *pCELL; /* Pointers to cells */ struct CELL { SYMBOL symbol; pCELL prev_in_block;...
29
by: foker | last post by:
I have this problem where I have 2 text files, one with student name, id#, # of courses and course #, the second file has course name and course number. I want to make a multidimensional array that...
2
by: Howard | last post by:
Hi, I've got a program whose main object contains an array of "cells", each of which contains an array of "sub-cells", each of which contains an array of "sub-sub-cells". The cells, subcells...
9
by: Mel | last post by:
I have 10 columns total. 3 of them are invisible. The rest are read- only BoundFields, 3 of which are editable fields using TemplateFields. Upon editing, I want to validate what the user enters...
2
by: gellis72 | last post by:
I'm working on a program that imports a bunch of data from a folder full of Excel files and compiles it into an Access DB. The Excel files have a varying number of rows and columns that need to be...
6
by: lukasso | last post by:
Hi, this is my code that should produce something like a timetable for a few days with each day divided into 30 minute pieces. It makes query from MySQL and then creates a 2d $array which then is to...
2
Claus Mygind
by: Claus Mygind | last post by:
I have an array of objects (a hash table). My section of code, the "for in" loop (lines 18 to 41) does not execute at full speed. But if I put in an alert box (line 13) to stop program execution...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.