473,499 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with layout mySQL query

hi there,

A few days ago i posted a question how i could divide a
query's result over 2 collumns.

I got the following code thanks to Pedro:
echo '<table class="search_result" summary="search result">';
$column = 0;
while ($row = mysql_fetch_array($result)) {
if (!$column) echo '<tr>';
echo '<td>', $row['whatever'], '</td>';
if ($column) echo '</tr>';
$column = !$column;

if ($column) echo '<td>(empty cell)</td></tr>';
echo '</table>';


It works great except for one thing:
When the result is for example 5 items,

The table looks like: Instead of:
_____ _____ _____ _____
|__x__|__x__| |__x__|__x__|
|__x__|__x__| |__x__|__x__|
|__x__| |__x__|_____|

"x" indicates an item.

Anyway, can someone please help me to get the table
structure correct? Any help would be great.

Greetings knoak
Jul 17 '05 #1
1 1650
knoak wrote:
A few days ago i posted a question how i could divide a
query's result over 2 collumns.

I got the following code thanks to Pedro:
echo '<table class="search_result" summary="search result">';
$column = 0;
while ($row = mysql_fetch_array($result)) {
if (!$column) echo '<tr>';
echo '<td>', $row['whatever'], '</td>';
if ($column) echo '</tr>';
$column = !$column;
}

I'm sorry if I didn't put that in the first time around -- but you
should have corrected it :-)

if ($column) echo '<td>(empty cell)</td></tr>';
echo '</table>';
It works great except for one thing:
When the result is for example 5 items,

The table looks like: Instead of:
_____ _____ _____ _____
|__x__|__x__| |__x__|__x__|
|__x__|__x__| |__x__|__x__|
|__x__| |__x__|_____|

"x" indicates an item.


To me, the code above shows the layout on the right.
Anyway, can someone please help me to get the table
structure correct? Any help would be great.


Post your code (or a stripped-down version of it) instead of the code
you used as a basis.

In my code, the first line after the while() loop is responsible for
filling the empty cell. Maybe you edited it out when you adapted the
code to suit your needs.

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #2

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

Similar topics

0
1704
by: thomas-lists | last post by:
Hey folks, before posting to the bugs-list I would like to try it here to get some help :). Every now and then MySQL-4.0.13 crashes on my Dual-Athlon-MP-machine. Its not reproducible nor I know...
1
6195
by: Lynton Towler | last post by:
Hello and thanks for reading this message. I have a Virtual Learning Environment (VLE) called "moodle 1.5.2" running on a server with 1Gb of RAM and MySQL version 4.1.13-1 which has been...
1
2764
by: James | last post by:
Hey everyone, I have a really obscure but impassable problem with a reasonably simple piece of php/PEAR DB/MySQL code When calling several stored procs the first call succeeds, but subsequent...
0
1615
by: Daniel Crespo | last post by:
Hi to all, I'm using adodb for accessing mysql and postgres. My problem relies on the mysql access. Sometimes, when I try to execute a query (using ExecTrans method below), I get this error:...
3
13942
by: auron | last post by:
Hi there, I have a really stupid and banal problem with showing the results of a MySQL query in PHP, preciselly with MySQL count() function that gives to a variable in PHP the result. NOTE:...
3
6072
by: Juan Antonio Villa | last post by:
Hello, I'm having a problem replicating a simple database using the binary log replication, here is the problem: When the master sends an update to the slave, an example update reads as follows:...
8
2000
by: Daz | last post by:
Hi everyone. I was faced with the choice of whether my problem is indeed a PHP problem or a MySQL. I have decided it's a PHP problem as I don't experience the same problem when I execute the...
9
5741
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
10
1656
by: paul814 | last post by:
I am having a bit of a problem with some code....can someone give me some suggestions? Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\production \date2.php on line 28 line 28 is...
0
7132
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
7223
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...
1
6899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.