Re: [PHP-DB] mysql table layout help needed

2001-12-21 Thread Chris Payne

Hi there,

I format my results using the following code:

  ?
// format results by row
while ($row = mysql_fetch_array($sql_result)) {
 $title = $row[title];
 $desc = $row[description];
 $image = $row[image];

$url = index3.php?image=.($row[image]);

?
  a href=?=$url??=$PHPSESSID?img src=images/?=$image?.jpg
align = center width=150 height=100 hspace=15 border=0br
  ?=$title?br
  /abr
  /font
  ?

}

// free resources and close connection
mysql_free_result($sql_result);
mysql_close($connection);

?

I prefer to use this method rather than echo's as it's easier to follow (I
don't know about any downsides though, I just know it's easier for me to
program this way).

I tried the code that you gave (Bogdan, thank you) but still being fairly
fresh to PHP I couldn't get it to work.  I need it to display 3 across and
however many down in a table, but can't for the life of me get it to work
the images just display ontop of each other or all on one line - wish I
could use programmers logic but i'm not a very logical person.

Any help would be very appreciated - something which fit in with the kind of
code I use above would be a GODSEND.

Thanks again and happy holidays :-)

Regards

Chris




-- 
PHP Database 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-DB] mysql table layout help needed

2001-12-20 Thread Chris Payne

Hi there everyone,

This is probably a really simple problem but for the life of me I can't figure out 
what i'm doing wrong.

My problem is I am getting 20+ results from a DB to display without any problems with 
the images etc . but they display one ontop of another (Of course with spacing 
underneath etc ...)  The problem however is that when I try to format the layout in a 
table it screws up.

I need the results to display 3 across and however many down as needed, but I can only 
get it to display either one ontop of the other or all of them going across the top of 
the screen which stretches the screen out unacceptably.

Please help me, I need to know how the table code should be to allow me to display 2 
or 3 items across and then down.

Thank you all for your help and Merry Christmas :-)

Chris



Re: [PHP-DB] mysql table layout help needed

2001-12-20 Thread Bogdan Stancescu

A sample of what you were trying would have been helpful...

If I understood your problem right, the solution is a piece of code like this:

?
  echo(table\ntr\n);
  while ($myrow=mysql_fetch_row($result))
  {
$colcount++;
if ($colcount==$desiredcolcount)
{
  $colcount=0;
}
if (!$colcount)
{
  echo(/tr\ntr\n);
}
echo(td[your output here]/td\n);
  }
  if ($colcount)
  {
for (;$colcount$desiredcolcount;$colcount++)
{
  echo(tdnbsp;/td\n);
}
  }
  echo(/tr\n/table);
?

Chris Payne wrote:

 Hi there everyone,

 This is probably a really simple problem but for the life of me I can't figure out 
what i'm doing wrong.

 My problem is I am getting 20+ results from a DB to display without any problems 
with the images etc . but they display one ontop of another (Of course with 
spacing underneath etc ...)  The problem however is that when I try to format the 
layout in a table it screws up.

 I need the results to display 3 across and however many down as needed, but I can 
only get it to display either one ontop of the other or all of them going across the 
top of the screen which stretches the screen out unacceptably.

 Please help me, I need to know how the table code should be to allow me to display 2 
or 3 items across and then down.

 Thank you all for your help and Merry Christmas :-)

 Chris


-- 
PHP Database 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]