Vote count:
0
i'm trying to update an existing page that already has a database so i'm hoping there's a way i can do it without having to go back and completely rework the database. i know how to create pagination for listing rows of data, but what i want to do is add pagination for the fields in a single row. the content on the page is filled using one row from the database and has a few different fields including images, but i want to break up this content and spread it out over a few pages. i know that the easy option would be to do it with jquery, but it's for a news site, and the main reason the client wants the change is to increase page views. here is the existing script:
$maxRows_rs_feed = 1;
$pageNum_rs_feed = 0;
if (isset($_GET['pageNum_rs_feed'])) {
$pageNum_rs_feed = $_GET['pageNum_rs_feed'];
}
$startRow_rs_feed = $pageNum_rs_feed * $maxRows_rs_feed;
$colname_rs_feed = "-1";
if (isset($_GET['ID'])) {
$colname_rs_feed = $_GET['ID'];
}
mysql_select_db($database_db, $db);
$query_rs_feed = sprintf("SELECT feed_id,
DATE_FORMAT(date,'%%D %%M %%Y @ %%l.%%i%%p')date,
author,
author_title,
category_1,
category_2,
thumb,
feed_image,
feed_title,
feed_sub_title,
intro_text,
1_title,
1_image,
1_image_credit,
1_textarea,
2_title,
2_image,
2_image_credit,
2_textarea,
3_title,
3_image,
3_image_credit,
3_textarea,
4_title,
4_image,
4_image_credit,
4_textarea,
5_title,
5_image,
5_image_credit,
5_textarea,
6_title,
6_image,
6_image_credit,
6_textarea,
7_title,
7_image,
7_image_credit,
7_textarea,
8_title,
8_image,
8_image_credit,
8_textarea,
9_title,
9_image,
9_image_credit,
9_textarea,
10_title,
10_image,
10_image_credit,
10_textarea FROM FEED_view WHERE feed_id = %s", GetSQLValueString($colname_rs_feed, "int"));
$query_limit_rs_feed = sprintf("%s LIMIT %d, %d", $query_rs_feed, $startRow_rs_feed, $maxRows_rs_feed);
$rs_feed = mysql_query($query_limit_rs_feed, $neonnettle) or die(mysql_error());
$row_rs_feed = mysql_fetch_assoc($rs_feed);
if (isset($_GET['totalRows_rs_feed'])) {
$totalRows_rs_feed = $_GET['totalRows_rs_feed'];
} else {
$all_rs_feed = mysql_query($query_rs_feed);
$totalRows_rs_feed = mysql_num_rows($all_rs_feed);
}
$totalPages_rs_feed = ceil($totalRows_rs_feed/$maxRows_rs_feed)-1;
basically, i want to have 1_title, 1_image, 1_image_credit and 1_textarea on the first page, 2_title, 2_image, 2_image_credit and 2_textarea on the second page, 3_title, 3_image, 3_image_credit and 3_textarea on the third page etc...
this is how it's currently displayed in the page:
<!-- FEED item NUMBER 1================================================= -->
<div id="1title" class="feedTitle"><h3>1: <?php echo $row_rs_feed['1_title']; ?></h3></div>
<div id="1image" class="feedImage"><img src="images/<?php echo $row_rs_feed['1_image']; ?>" alt="feed image"></div>
<div id="1photo" class="feedCredit">Photo Credit: <?php echo $row_rs_feed['1_image_credit']; ?></div>
<div id="1text" class="feedText"><?php echo $row_rs_feed['1_textarea']; ?></div>
<!-- FEED item NUMBER 2================================================= -->
<div id="2title" class="feedTitle"><h3>2: <?php echo $row_rs_feed['2_title']; ?></h3></div>
<div id="2image" class="feedImage"><img src="images/<?php echo $row_rs_feed['2_image']; ?>" alt="feed image"></div>
<div id="2photo" class="feedCredit">Photo Credit: <?php echo $row_rs_feed['2_image_credit']; ?></div>
<div id="2text" class="feedText"><?php echo $row_rs_feed['2_textarea']; ?></div>
<!-- FEED item NUMBER 3================================================= -->
<div id="3title" class="feedTitle"><h3>3: <?php echo $row_rs_feed['3_title']; ?></h3></div>
<div id="3image" class="feedImage"><img src="images/<?php echo $row_rs_feed['3_image']; ?>" alt="feed image"></div>
<div id="3photo" class="feedCredit">Photo Credit: <?php echo $row_rs_feed['3_image_credit']; ?></div>
<div id="3text" class="feedText"><?php echo $row_rs_feed['3_textarea']; ?></div>
<!-- FEED item NUMBER 4================================================= -->
<div id="4title" class="feedTitle"><h3>4: <?php echo $row_rs_feed['4_title']; ?></h3></div>
<div id="4image" class="feedImage"><img src="images/<?php echo $row_rs_feed['4_image']; ?>" alt="feed image"></div>
<div id="4photo" class="feedCredit">Photo Credit: <?php echo $row_rs_feed['4_image_credit']; ?></div>
<div id="4text" class="feedText"><?php echo $row_rs_feed['4_textarea']; ?></div>
and so on. as you can see, there's a title, image, image_credit and some text for each section, but i want to break this up into separate pages rather than just list them on the same page. any help would be much appreciated as this has been melting my brain all day! sorry for the long post, but please let me know if i've missed out any info? cheers.
Aucun commentaire:
Enregistrer un commentaire