/    Sign up×
Community /Pin to ProfileBookmark

looping and expanding a table to the right

ok, so i’ve got a bit of a challenge ahead of me. i’m new to the forum too, so this is a good way to start getting to know some of you guys.

here’s what i got to do, problem is, i don’t even know where to begin, this is the first time that i attempt something like this.

alright, so the idea is that i have a ‘tree’ that grows whenever someone signs up to be a sponsor for the site i’m building.

the way i set it up, you can see [URL=”http://delrioadvertising.com/ftp/treeoflife/”]here[/URL].

basically, i would like to set up a loop that shows all of the sponsors that’ll be in the database. then display it on the aforementioned tree. one sponsor per leaf. each leaf is those ‘diamond shaped’ things.

here’s where i’m stuck: i’d like to be able to display the sponsors in a table that expands to the right rather than down. i know it’s easy to set up scripts that’ll write new rows into tables, but, is there a way to set up a table that expands to the right? is it possible? has anyone done it before?

thanks guys, i appreciate any and all help i can get.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@furnissgFeb 05.2008 — from the site it looks like you want 2 fields name and organisation, i would assume you have it stored in the database as 2 fields

[code=php]
<?php

$query = mysql_query($sql) //get the results

$organisations = array();

echo '<table>';

echo '<tr>';

echo '<td>Name</td>';

while($result = mysql_fetch_assoc($query){

echo '<td>'.$result['sponser_name'].'</td>';

array_push($organisations, $result['organisation']);

}

echo '</tr>';

echo '<tr>';

echo '<td>Organisation</td>';

foreach($organisations as $org){

echo '<td>'.$org['organisation'].'</td>';


}

echo '</tr>';

echo '</table>';

?>
[/code]


you essentially need to write the row of names then the row of organisations, also you need to be careful as to where it stops as it can easily expand far to the right and throw the design off,

hope that helps
×

Success!

Help @toeknee spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...