473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to close table

hello and please excuse me again for my clumsy english.

As I wrote few weeks ago, I'm not programer, but I have to create one
script. that is a gallery script, and after successful work on flatfile
gallery script I'w decided to build mysql script.
frontend is almost done, everything is working fine, except ending of
tables..

I will try to describe and draw what I mean:

if I have 8 pics to be shown, and if choose to have 4 columns in row,
table will close fine:
<table>
<tr><td>IMG</td><td>IMG</td><td>IMG</td><td>IMG</td></tr>
<tr><td>IMG</td><td>IMG</td><td>IMG</td><td>IMG</td></tr>
</table>

but, if I have 9 pics, i will have "hole" in my table:

<table>
<tr><td>IMG</td><td>IMG</td><td>IMG</td><td>IMG</td></tr>
<tr><td>IMG</td><td>IMG</td><td>IMG</td><td>IMG</td></tr>
<tr><td>IMG</td></tr>
</table>

now... how to draw those missing <td>&nbsp;</td>?
or to create <td colspan=\"$somenumber\"> ?

how to calculate that $somenumber ?
(that solution with colspan is easier, but I would like to learn both
solutions)

here is one part of my code:
(I believe that it can be written much nicer, but again, I'm just
starting with your language... php I mean.)

function collect_authors() {
global $incl, $incp, $tbrd, $PHP_SELF, $i;

print "<table border=\"$tbrd\" cellspacing=\"0\"
cellpadding=\"$incp\"><tr>\n";

// subfunction get AUTOR
$query1 = "SELECT AutorID,AutorName,AutorPrez,AutorPict FROM
autor";
$result1 = mysql_query ($query1) or die ("shit, f*query failed
($query1)");
while (list($AutorID,$AutorName,$AutorPrez,$AutorPict) =
mysql_fetch_array($result1)) {
// takeing picture size and calculating squized
thumbnail
list($width, $height, $type, $attr) =
getimagesize("faces/$AutorPict");
$smal = $width / 50;
$heih = floor($height / $smal + 0.5);
print "<td align=\"right\" valign=\"top\">\n\n".
"<table width=\"100%\" border=\"0\"
cellspacing=\"2\" cellpadding=\"0\">\n<tr>\n<td colspan=\"2\"
align=\"left\" valign=\"bottom\">\n".
"<a class=\"autor\"
href=\"$PHP_SELF?AutorID=$AutorID\"><br>$AutorName
$AutorPrez</a>\n</td>\n</tr>\n".
"<tr>\n<td align=\"right\" valign=\"top\">\n".
"<p>\n<img class=\"pict\" src=\"faces/$AutorPict\"
alt=\"$AutorName\" width=\"50\" height=\"$heih\">\n</p>\n".
"</td>\n<td align=\"left\" valign=\"top\">\n";

// subfunction get ALBUM
$query2 = "SELECT AlbumID,AlbumName FROM album WHERE
AutorID=$AutorID";
$result2 = mysql_query ($query2) or die ("shit, f*query
failed ($query2)");
while (list($AlbumID,$AlbumName) =
mysql_fetch_array($result2)) {
print "<p>\n<a class=\"album\"
href=\"$PHP_SELF?AlbumID=$AlbumID\">$AlbumName</a>\n</p>\n";
}
print "</td>\n</tr>\n</table>\n\n</td>\n";
$i++;
if ($i % $incl == 0) {
print "</tr>\n<tr>\n";
}
}
print
"</table>\n\n";
}

tnx for any help.

--
Jan_ko?
--
Jul 17 '05 #1
1 2535
function collect_authors() {
global $incl, $incp, $tbrd, $PHP_SELF, $i;

print "<table border=\"$tbrd\" cellspacing=\"0\"
cellpadding=\"$incp\"><tr>\n";

// subfunction get AUTOR
$query1 = "SELECT AutorID,AutorName,AutorPrez,AutorPict FROM
autor";
$result1 = mysql_query ($query1) or die ("shit, f*query failed
($query1)");
while (list($AutorID,$AutorName,$AutorPrez,$AutorPict) =
mysql_fetch_array($result1)) { ---snip $i++;
if ($i % $incl == 0) {
print "</tr>\n<tr>\n";
}
} if ($i % incl) {
print "<td colspan="($i % $incl)"></td>";
} print
"</table>\n\n";
}

tnx for any help.

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: kevin dalby | last post by:
I use the script below to open a side panel on my desktop without all the buttons and menu items. IE 6 It works well. What I'd like to add is add a line of code that will close the calling...
3
by: Asit | last post by:
<META HTTP-EQUIV="expires" content="0"> <META HTTP-EQUIV="pragma" content="no-cache"> <html> <head> <title>Fidelity NetBenefits</title> </head> <body BGCOLOR="#ffffff"> <script...
6
by: marcelf3 | last post by:
Hello.. This page opens a window with some information, but everytime the user changes a field in the parent window, the child window needs to be closed. These 2 functions were supposed to do the...
19
by: Lauren Wilson | last post by:
A2K app: Question: is the flagged line (<<<) below necessary. If that line is needed, what effect does it have (if any) on the fact that the very same database is the linked back end db? ...
0
by: bonita | last post by:
In my ASP.NET page, I have 2 checkboxes for users to choose which crystal report they want to display. These two reports use different tables. If report1 has been choosen and displayed in the...
1
by: oliver gargour | last post by:
Hello, I am using the following code in a popup. <html> <head> <title></title> </head> <body onLoad="this.focus();" onblur="self.close"> <form action="" method="get">
15
by: Andyza | last post by:
I'm looking at another developers code and I'm now confused about the correct way to close a database connection and destroy the object. I would normally do it this way: Set conn =...
4
by: Martin Arvidsson, Visual Systems AB | last post by:
Hi! I am currently developing my first webapplication using .net (2.x) In a couple examples seen in the helpfile that came with VS2008 i see that they are opening a connection to the sql...
1
by: =?Utf-8?B?TG91aXM=?= | last post by:
Our code is shown as below. Does anyone knows why the sleep connection not close? <HTML> <HEAD> <TITLE>TheBestSteakHouseStL.com - Reviews</TITLE> <meta http-equiv="Content-Style-Type"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.