473,508 Members | 2,400 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 2308
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
3149
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...
1
1381
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...
2
5397
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...
11
1966
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...
9
1823
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...
1
1216
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....
5
4307
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...
3
2899
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...
4
1347
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...
1
1601
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...
0
7223
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
7377
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
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
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,...
1
5045
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
3191
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
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1544
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 ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.