473,666 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cgi limit display messages per page

2 New Member
Hi,

I am working on a cgi assignment where I need to break 10 messages, limit each page to display 3 messages and the reminder (1 in this case) on the last page.

I am having trouble using arithmetic operations to divide the pages.

Any suggestions?
Nov 25 '12 #1
2 2320
Rabbit
12,516 Recognized Expert Moderator MVP
Show us your arithmetic so we can see where you went wrong.
Nov 25 '12 #2
mazdajai
2 New Member
I think my problem is to specific the for-loop that limit the page displays into the last foreach loop. Sorry for the messy code, still a work in progress.
-----
Expand|Select|Wrap|Line Numbers
  1. @data = &OpenFile("data.txt");
  2. $total = @data;
  3. print "content-type: text/html\n\n";
  4. print "Total $total Messages<hr>\n";
  5. $maxRecords = 3;
  6. $pageCount = $total / $maxRecords + .4 ;
  7. $pageid = sprintf ("%.0f", $pageCount);
  8.  
  9. foreach $data (@data) {
  10.     ($id, $name, $email, $message) = split /\t/, $data    
  11.  
  12. for ($count = 1 ; $count <= $maxRecords; $count++) {
  13.     print "ID: $id<br>\n";
  14.     print "Name: $name<br>\n";
  15.     print "E-mail: $email<br>\n";
  16.     print "Message: $message<br>\n";
  17.     $id++;    
  18.  
  19. foreach $page (1..$pageid) {
  20.     print "<a href=\"read1.cgi?id=$page\"><font color=\"blue\">Page $page</font></a>\n";
  21. }
  22.  
Nov 25 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3151
by: Hannah Wang | last post by:
I have IIS installed on Win XP. When I type http://localhost/*.html (*.html mean any htm file) in IE, it works well. The page is displayed. But for any http://localhost/*.asp file, it always return either HTTP 500 Internal server error or Cannot find DNS server. I tried http://localhost/iishelp, it does not work also. Any suggestion?
1
1392
by: baltimore | last post by:
Hi, I look for a script allowing to display a page in a frame as from a link in a pop up (and close it in the same time The name of my frame is "body" In the pop up i try this function in the head section : function reroutage() { parent.frames.window.location="assistance.htm"; window.close();
2
5407
by: Patrick Tan | last post by:
I have a tablespace which is approaching 64 GB (for a single table), i understand that for 4k page sized tablespaces, this is sized tablespace, what's the best way / fastest way to do it ? can redirect restore change page size ? I am looking for suggestions. thanks! Patrick Tan
11
1977
by: VB Programmer | last post by:
Is there a limit as to how big an aspx page's html can be? (number of characters) Why do I ask? I have a webform with a lot of ActiveX controls (shows up as OBJECT in html). When I place like 35 of these objects the form shows up BLANK in a web browser. When I remove a few (ANY few) I can see the page. Any ideas? Thanks.
9
1839
by: veg_all | last post by:
I have a script that takes collects info from various websites to compile a report. However whenever I run it, my web browser waits for the script to finish ( 1 minute ) before displaying the report. But my script is outputting data every few seconds . So is there a way to make my browser display the web page every few seconds and update automatically as more data comes?
1
1219
by: manjith | last post by:
hai.. I want to edit a database with DATAGRID. The database contains MEMBERCODE(varchar), NAME(varchar), ACTIVE(boolean). I want to add a messages in gridview depends upon the ACTIVE field. i.e. the message like thiswhen Active==1, . Also the messages depends upon the presents position of the boolean field should be displayed in pageload and editing. PLEASE HELP ME
5
4311
by: zlf | last post by:
Hello, I try to use a custom HttpHandler to add something to session, then display the original page. public void ProcessRequest(HttpContext context) { context.Session = "test"; } But, a empty page is rendered with this HttpHandler, should I add some
3
2905
by: koutoo | last post by:
Is it possible to display messages in the python shell? I want to display error messages based on parameters in my scripts to the users. Is there another way to display messages other than log files? Thanks. Kou
4
1357
by: sathiya | last post by:
I have created some html report for my application. But I am not able to display the information page by page. Like this, ----------------------------------------------- Page Header ----------------------------------------------- ---------------------------------------------- Sub heading ----------------------------------------------
1
1613
by: ashfaqbinnazar | last post by:
Dear friends, How can i display messages from mysql database in each rows with delete and reply button. Thanks in advance. Here is my code. i have created a page like scrapbook. and splitted the scrapbook into two,ie my scrapbook and my friends scrapbook. $toid is active only when i visit others profile. if $toid is blank then display my scrqapbook otherwise my friend scrapbook. <td><table width="100%" height="99" border="1">
0
8448
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8783
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7387
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2773
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 we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.