Home Backend Development PHP Tutorial Two ways to display horizontal repeating areas in php_PHP tutorial

Two ways to display horizontal repeating areas in php_PHP tutorial

Jul 21, 2016 pm 03:49 PM
php one area picture definition method show Horizontal Notice of want Record repeat

Method 1. Note that there is a predefined picture record set rsmpic. The pictures to be repeated horizontally are pictures. Please change the name of your record set according to your situation. Neatly put the horizontally repeated content in a table
< table width="100" border="0" align="center" cellpadding="5" cellspacing="5">
<?PHP $startrw = '0';// Start defining horizontal repeating content here Set to 3 rows and 3 columns $endrw = $HLooper1__index;
$numberColumns = '3';
$numrows = '3';
while(($numrows <> 0) AND (! $rsmpic->EOF))
{
$startrw = $endrw + 1;
$endrw = $endrw + $numberColumns;?>
<tr>
< ?PHP While (($startrw <= $endrw) AND (!$rsmpic->EOF)) { //Start repeating content?>
<td>
<table width="78 %" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../<?PHP echo $rsmpic- >Fields('M_Path'); ?>" border="0"></td>
</tr>
</table>
</td>
<?PHP
$startrw = $startrw + 1;
$rsmpic->MoveNext();}//The above repeats td content?>
</tr>
<?PHP $numrows=$numrows-1;
Wend; }
Method 2. Drag the repeat mark outside the <td> (vertical repetition is outside the <tr>), and add a variable, Add 1 for each repetition, if %3 is equal to 0 echo a "<tr>" . Please look carefully
<table width="100%" border="1" cellspacing="1" cellpadding="5 ">
<tr>
<?PHP $str=0;//Start defining a repeating function?>
<?PHP do { //Start repeating?>
<td>
<?PHP $str++;?>
<?PHP echo $str; ?>.<?PHP echo $row_Recordset1['NAME']; ?>
</td>
<?PHP if ($str%3==0)echo "<tr>"; ?>
<?PHP } while ($row_Recordset1 = MySQL_fetch_assoc($ Recordset1)); // Repeat td content?>
</tr>
</table>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319540.htmlTechArticleMethod 1. Note that there is a predefined picture record set rsmpic. The pictures you want to repeat horizontally are the pictures. Please follow your Change the situation to your recordset name. Neatly place the horizontal repeating content...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

CakePHP Date and Time

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

CakePHP Project Configuration

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

CakePHP File upload

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

CakePHP Routing

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

Discuss CakePHP

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP Quick Guide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

See all articles