beginers php question!

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
glens1234
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Feb 19, 2008 8:13 pm

beginers php question!

Post by glens1234 » Mon Mar 03, 2008 6:26 pm

Hi
I have the results from a database, which i am trying to display in either a table or using css etc.
At the moment it displays...

Translator Search

Name Languages Spoken
test: English,French,Spanish,German
glen simister: English,French
glen simister: English,French,Spanish,German

However i would like it to be formatted in two columns like this (without the dashes).
Name-------------------------Languages Spoken
test---------------------------English,French,Spanish,German
glen simister----------------English,French
glen simister----------------English,French,Spanish,German

here is the code...

Code: Select all

$database->setQuery($query);
$rows = $database->loadObjectList();

echo "<h2>Translator Search</h2><br />";
echo "Name Languages Spoken<br /> ";
foreach ( $rows as $row ) {
echo "$row->name: $row->languages_spoken<br />";
}
Can someone please sugguest how i can do this???
Thanks.
A will is a dead giveaway
A plateau is a high form of flattery

glens1234
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Feb 19, 2008 8:13 pm

Re: beginers php question!

Post by glens1234 » Mon Mar 03, 2008 7:20 pm

no worries. ive sorted it.

Code: Select all

$database->setQuery($query);
$rows = $database->loadObjectList();

echo "<h2>Translator Search</h2><br />";
echo "Name Languages Spoken<br /> ";
foreach ( $rows as $row ) {
print "<table width=400 border=1>\n";
print "<tr>\n";
print "<td>$row->name:</td><td>$row->languages_spoken</td>\n";
print "</tr>\n";
print "<table>\n";
}
The column lengths are slightly uneven but a background image should sort that out.
A will is a dead giveaway
A plateau is a high form of flattery


Post Reply