> > i have a mysql table with approx. 30 entries.
> >
> > I wanna get them(i know how to do that) and list them in a 2-column
table.
For those minimalist-typists among us... :-)
$rowcount = 0;
echo "\n";
while (list($whatever) = mysql_fetch_row($result)){
echo "$whatever\n";
$rowcount++;
else echo " "; // this avoids that hole in your grid
}
echo "";
-Original Message-
From: Zak Greant [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 23, 2001 1:22 PM
To: McShen
Cc: Php-General
Subject: Re: [PHP] newbie algorithm help!
McShen wrote:
> > hi
> >
I use this code to do this kind stuff:
- BEGIN ---
$result=mysql_query(...);
$columns=2; //Count of columns
$table="\n";
$table.='';
$col=0; //current column
//Draw table content
while ($row=mysql_fetch_row($result)){
$table.=''.$row[0].'';
$c
McShen wrote:
> > hi
> > i have a mysql table with approx. 30 entries.
> >
> > I wanna get them(i know how to do that) and list them in a 2-column
table.
> I
> > have been trying to use a loop to do it. But it will only produce a
> 1-column
> > table. it's like
> >
> > entry 1
> > entey 2
> > entr
is this what you want? there must be an
easier way. i am sure some one else knows it be i would -
$result = mysql_query("select * from
table");
?>
$i = 0;
while($my_array =
mysql_fetch_array($result))
{
if($i%2)
{
print"{$my_array[0]";
}
else
{
print"{$my_array[0]}";
}
$i++:
}
or
please share if you know hwo to di it. thanks you
""McShen"" <[EMAIL PROTECTED]> wrote in message
9gqm6o$g6n$[EMAIL PROTECTED]">news:9gqm6o$g6n$[EMAIL PROTECTED]...
> hi
> i have a mysql table with approx. 30 entries.
>
> I wanna get them(i know how to do that) and list them in a 2-column table.
> I wanna get them(i know how to do that) and list them in a
> 2-column table. I have been trying to use a loop to do it. But it
> will only produce a 1-column table. it's like
>
> entry 1
> entey 2
> entry 3
> entry 4
> etc
>
> Please help me so that i can get this :
>
> entry1 entry2
> entr
";
foreach($array as $pos => $val)
if ( !(@$row++ % 2) AND $row != 1)
echo "
$val
";
else
echo "
$val
";
echo "
";
?>
--
Chris Lee
[EMAIL PROTECTED]
""McShen"" <[EMAIL PROTECTED]> wrote in message
9gqm6o$g6n$[EMAIL PROTECTED]">news:9gqm6o$g6n$[EMAIL
8 matches
Mail list logo