try changing these lines:
echo "<tr>";
for ($i = 6; $i <= 25; $i++) {
echo "<td valign=top align=left
class=normal>".stripslashes($models[$i])."</td>";
}
echo "</tr>";
to:
echo "<tr><td valign=top align=left class=normal>";
for ($i = 6; $i <= 25; $i++) {
echo
stripslashes($models[$i])."<br>";
}
echo "</td></tr>";
Martin T
-----Original Message-----
From: Ren� Fournier [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 09, 2001 10:06 AM
To: Php-General
Subject: RE: [PHP] Array HELP PLEASE
Or maybe not. :-) Although I got both rows displaying, they're actually two
long to fit comfortably (w/o horizontally scrolling). So... I'd like to
flip the axis of the table, so my header row runs vertically. But with the
vagaries of html tables, I'm kinda stumped as to how to run the do/while+for
loop. This is what I've got now (more or less):
fld1 fld2 fld3
big red house
little blue dog
long yellow string
With this code:
=======================================
// MODELS A
echo "<table border=1 cellpadding=2 cellspacing=0>";
echo "<tr>";
for ($i = 6; $i <= 25; $i++) {
echo "<td valign=top align=left
class=deemph>".stripslashes($modelsheader[$i])."</td>";
}
echo "</tr>";
do {
echo "<tr>";
for ($i = 6; $i <= 25; $i++) {
echo "<td valign=top align=left
class=normal>".stripslashes($models[$i])."</td>";
}
echo "</tr>";
} while ($models = mysql_fetch_array($result));
echo "</table>";
=========================================
This is what I WOULD LIKE to have:
fld1 big little long
fld2 red blue yellow
fld3 house dog string
==================================
I can't figure how I would display element 1 of $modelsheader and every
first element of $models, then increment and loop... That is, I would like
to be able to refer to $models such that $models[0][0] referred to the first
element of the first row and, say, $models[1][0] referred to the first
element of the second row, and so on.
> -----Original Message-----
> From: Ren� Fournier [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 3:39 PM
> To: Php-General
> Subject: RE: [PHP] Array HELP PLEASE
>
>
> Oops, guess I posted too soon. Just figured out the problem myself (use a
> do/while...). Thanks anyways.
>
> > -----Original Message-----
> > From: Ren� Fournier [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, November 08, 2001 3:25 PM
> > To: Php-General
> > Subject: [PHP] Array HELP PLEASE
> >
> >
> > (Before you write RTFM, please know that I have checked www.php.net,
> > zend.com, phpbuilder.com, et all, and--in the eternal words of
> > Bono--I still
> > haven't found what I'm looking.)
> >
> > The situation: I extract an array from a MySQL table. Code:
> >
> > $models = mysql_fetch_array(mysql_query("SELECT * FROM models WHERE
> > lang='$lang' AND key1='data' AND key2='$series'",$db));
> >
> > Based on the above criteria, there should be two rows in
> $modelsrow, with
> > each row containing about twenty elements. (A two-dimensional array,
> > right?) All I want to do is display the contents of $models. With the
> > following...
> >
> > for ($i = 1; $i <= 20; $i++) {
> > echo $models[$i]."<p>";
> > }
> >
> > ...I get just one row. How can I also display the other row?
> I've tried
> > variations of $models[1][2], but I just can't get right syntax.
> (Help is
> > much appreciated. Thanks.)
> >
> > If you know of a good tutorial on multidimension arrays + mySQL,
> > that would
> > be nice too.
> >
> > ...Rene
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]