473,406 Members | 2,620 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,406 software developers and data experts.

3 Column repeat region? {DW}

[FYI:I'm using Dreamweaver 2004 for my interface. ]
I don't have a problem laying out a recordset in php/mysql, but each record
is returned in a single row in a table file.
Is there a way to return say 3 images and descriptions in a 3 column list
instead? I mean I'd like the repeating region to be horizontal for three
records, e.g., rather than merely one repeating row for each item.

Thanks
Jeff


~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.com

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #1
7 3378
I noticed that Message-ID: <BE***********************@hotmail.com> from
Jefferis NoSpamme contained the following:
I don't have a problem laying out a recordset in php/mysql, but each record
is returned in a single row in a table file.
Is there a way to return say 3 images and descriptions in a 3 column list
instead? I mean I'd like the repeating region to be horizontal for three
records, e.g., rather than merely one repeating row for each item.


Not sure how DW would tackle this but let's consider the code. For
three columns you need:

<tr><td>description</td><td>image</td>

then

<td>description</td><td>image</td>

then

<td>description</td><td>image</td></tr>

Notice the differences?

The bit in the middle stays the same, only the ends change.
Suppose we define two arrays
$s=array("<tr>","","");
$e=array("","","</tr>"

Then something like

$s[0]<td>description</td><td>image</td>$e[0]

$s[1]<td>description</td><td>image</td>$e[1]

$s[2]<td>description</td><td>image</td></tr>$e[2]

Should do what we want.

Finally you just need a method of generating those array indices.
Start by initialising a counter
$i=0;

Clearly, for the first row you have
$s[$i]<td>description</td><td>image</td>$e[$i]

But $i needs to increment before we get the next row (but go back to
zero every third row)

So..

$i++;
if($i>2){$i=0;}
All you have to do is put it together...

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
Hi Geoff,
Maybe this will work, but the trouble I'm having is more in line with how
the MySQL queries are displayed as a result of repeated regions. The code
below may clarify the problem:
On 2/4/05 3:11 PM, in article k5********************************@4ax.com,
"Geoff Berrow" <bl******@ckdog.co.uk> wrote:
$s[0]<td>description</td><td>image</td>$e[0]

$s[1]<td>description</td><td>image</td>$e[1]

$s[2]<td>description</td><td>image</td></tr>$e[2]

Should do what we want.

So..

$i++;
if($i>2){$i=0;}


Let me give you some of the code and the query at the bottom.
The display table:
<table width="550" border="2" align="center" cellpadding="0" cellspacing="1"
bordercolor="#333333">
<tr>
<td width="50%">
<div align="center">
<p><?php echo $row_viewall['descrip']; ?> </p>
....
<?php echo $row_viewall['item_name']; ?>" border="0"></a><br>
<?php echo $row_viewall['designer']; ?>
<br>
<?php echo $row_viewall['item']; ?></div></td>
</tr>
</table>
<?php } while ($row_viewall = mysql_fetch_assoc($viewall)); ?>
The query is set up to display info linked to the database row.

The Query:

~~~~~~~~~~~~~~

$maxRows_viewall = 5;
$pageNum_viewall = 0;
if (isset($_GET['pageNum_viewall'])) {
$pageNum_viewall = $_GET['pageNum_viewall'];
}
$startRow_viewall = $pageNum_viewall * $maxRows_viewall;

mysql_select_db($database_jodenonline, $jodenonline);
$query_viewall = "SELECT * FROM `Catalog` WHERE `Catalog`.img_status = '1'
AND `Catalog`.designer Like '%Victorian%' ORDER BY `Catalog`.sold ASC";
$query_limit_viewall = sprintf("%s LIMIT %d, %d", $query_viewall,
$startRow_viewall, $maxRows_viewall);
$viewall = mysql_query($query_limit_viewall, $jodenonline) or
die(mysql_error());
$row_viewall = mysql_fetch_assoc($viewall);

if (isset($_GET['totalRows_viewall'])) {
$totalRows_viewall = $_GET['totalRows_viewall'];
} else {
$all_viewall = mysql_query($query_viewall);
$totalRows_viewall = mysql_num_rows($all_viewall);
}
$totalPages_viewall = ceil($totalRows_viewall/$maxRows_viewall)-1;

$queryString_viewall = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_viewall") == false &&
stristr($param, "totalRows_viewall") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_viewall = "&" . implode("&", $newParams);
}
}
$queryString_viewall = sprintf("&totalRows_viewall=%d%s",
$totalRows_viewall, $queryString_viewall);
?>

~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.com

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #3
I noticed that Message-ID: <BE***********************@hotmail.com> from
Jefferis NoSpamme contained the following:
Maybe this will work, but the trouble I'm having is more in line with how
the MySQL queries are displayed as a result of repeated regions. The code
below may clarify the problem:


You need to understand how this works. The query returns rows and the
while loop iterates through the rows. While you are simply displaying
rows as table rows the code can be the same each time. To save it in
groups of three means that the region needs to change each row of the
iteration.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4
Is is possible to change each region without calling in an overlapping
display of the items? Everything seems to be structured by the WHILE to call
each record sequentially. While it might be possible to call items by row
and column, the WHILE statement would create columns infinitely to the end
of the query unless bounded.
Dreamwweaver is no help in structuring this query and display because it
defaults to sequential rows. Since the database itself is structured by row
per item, a column data call might get really hairy.
I just can't think of how this layout might be done.

Thanks
Jeff
On 2/4/05 6:20 PM, in article 66********************************@4ax.com,
"Geoff Berrow" <bl******@ckdog.co.uk> wrote:
You need to understand how this works. The query returns rows and the
while loop iterates through the rows. While you are simply displaying
rows as table rows the code can be the same each time. To save it in
groups of three means that the region needs to change each row of the
iteration.


~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.com

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #5
Hey Geoff,
I think this $e array would not work properly. You have the $e at the end of
each $s, but that would create a new row after each image/description pair.
The <tr> has to be outside each set of 3 returned items.

For simplicity's sake, let's just use 1 item in a cell, called item
name.The record set query is calling 100 items, say.

<tr>
<?php do { ?>

<td >
<?php echo $row_RecordSet1['item_name']; ?>
</td>

<?php } while ($row_RecordSet1 = mysql_fetch_assoc($RecordSet1)); ?>
</tr>

And I have maximum records per page:
$maxRows_RecordSet1 = 9;
I keep trying to create a for while loop, but I'm getting stumped.

Jeff

On 2/4/05 3:11 PM, in article k5********************************@4ax.com,
"Geoff Berrow" <bl******@ckdog.co.uk> wrote:

Notice the differences?

The bit in the middle stays the same, only the ends change.
Suppose we define two arrays
$s=array("<tr>","","");
$e=array("","","</tr>"

Then something like

$s[0]<td>description</td><td>image</td>$e[0]

$s[1]<td>description</td><td>image</td>$e[1]

$s[2]<td>description</td><td>image</td></tr>$e[2]

Should do what we want.

Finally you just need a method of generating those array indices.
Start by initialising a counter
$i=0;

Clearly, for the first row you have
$s[$i]<td>description</td><td>image</td>$e[$i]

But $i needs to increment before we get the next row (but go back to
zero every third row)

So..

$i++;
if($i>2){$i=0;}

~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.com

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #6
I noticed that Message-ID: <BE***********************@hotmail.com> from
Jefferis NoSpamme contained the following:
I think this $e array would not work properly. You have the $e at the end of
each $s, but that would create a new row after each image/description pair.


No it wouldn't because it's an array
$s=array("<tr>","","");
$e=array("","","</tr>"

$e[0] is empty.
$e[1] is empty
only$e[2] contains the </tr>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #7
Doh!

:-)

On 2/7/05 3:55 PM, in article 6j********************************@4ax.com,
"Geoff Berrow" <bl******@ckdog.co.uk> wrote:
No it wouldn't because it's an array
$s=array("<tr>","","");
$e=array("","","</tr>"

$e[0] is empty.
$e[1] is empty
only$e[2] contains the </tr>


~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.com

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #8

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

Similar topics

8
by: duncan.lovett | last post by:
PHP 4 MySQL 4.0.20 DW MW 2004 7.01 This problem is giving me a bit of a headache, and I'm getting nowhere with it so thought I'd open it up to all, any help would be greatly appreciated. ...
1
by: RJ | last post by:
Hello! I am trying to lay out a left navigation column with a background image, where the left nav column runs the entire scrolled height/length of the page. The float:left column layout works...
19
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to...
0
by: Simon Gare | last post by:
Hi, I need to calculate a total based on fields in a repeat region, these values are stored in an SQL db, all are numeric and written in ASP. fields are TOTAL_COST VAT ...
31
by: Sarita | last post by:
Hello, this might sound stupid, but I got a really nice homepage template which unfortunately is a 3-Column Fixed Width CSS format. Now I don't have any content for the right column and would...
1
by: nicky77 | last post by:
hi there, i'm pretty inexperienced with CSS, so apologies for the shoddy coding. i'm trying to set a 3 column layout using different background images for each column. however, i have whitespace at...
6
by: Christopera | last post by:
I built a this sites http://www.ourzeal.com/walko/index.html . If you look closely at the far right column it is about 1 px higher than the other two. The source does validate. I can not however...
1
by: Tjwapa | last post by:
How do i convert a column with id letters in a file to a number 1 or 0 in coldfusion output....for example 'CON' or 'BUS' to be converted to an output of '0'and '1' (0 to represent CON and 1 for...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.