473,413 Members | 1,799 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,413 software developers and data experts.

Storing newly Incremented number

Hi all,

I have a form with a field called ReportID in aspx on our local Intranet. Everytime this report is loaded into a browser, I need the ReportID field to be incremented by one. I got this to work with Javascript except when the page was closed and reloaded, the ReportID field was set back to one instead of storing the new number and incrementing from there.

I was told that writing a PHP script and storing the incremented number in a file or db would be my best option.

Can someone please let me know where I need to start in order to do this?

Thanks.
Apr 23 '08 #1
5 1366
Markus
6,050 Expert 4TB
Are you able to use a database? Such as MySQL?

If so, there are many, many tutorials out there - and from what i read you're needs are pretty basic.
Apr 23 '08 #2
Are you able to use a database? Such as MySQL?

If so, there are many, many tutorials out there - and from what i read you're needs are pretty basic.
I would be able to use SQL Server but would prefer just using a flat file if possible. I don't want to clutter up our SQL server db with just one column for storing numbers. Is that possible?
Apr 23 '08 #3
Markus
6,050 Expert 4TB
I would be able to use SQL Server but would prefer just using a flat file if possible. I don't want to clutter up our SQL server db with just one column for storing numbers. Is that possible?
Sure it's possible!

Have a look at tizag.com's file tutorials


When you've had a play around, come back and we'll help you from there :)
Apr 23 '08 #4
Sure it's possible!

Have a look at tizag.com's file tutorials


When you've had a play around, come back and we'll help you from there :)
Thanks for the tutorial and now for my questions. :-)

Here is what I have for code:

[PHP]
$ourFileName = "reportid.txt";
$fh = fopen($ourFileName, 'r') or die("Can't open file");
$theData = fgets($fh);
fclose($fh);
echo $theData;
[/PHP]

I have created a file called ReportID.txt and typed a list of numbers in it: i.e. 1000
1001
1002...etc.

First question: Where do I put this code on my page so that the value that is read into the script (for ex: 1000) displays in my ReportID text box? I understand that echo means display what's in the text file but I want it to put that value in my text box on my page.

Second question: Does the script know to read the next line of the ReportID.txt file when the page is loaded again or do I need to use Append+ (a+) instead of Read (r)? **update (I answered this question myself, so ignore it** :-)

Thanks!
Apr 23 '08 #5
ronverdonk
4,258 Expert 4TB
If you mean by text box, an input text field (and not an input drop down box) something like[php]echo "<input type='text' name='txtname' value='$theData' />";[/php]will do.

Ronald
Apr 24 '08 #6

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

Similar topics

14
by: mjkahn | last post by:
I've read (and read!) that you shouldn't store objects in Session variables. I've read these reasons: - The object takes up memory that may not be freed until the session times out. Better to...
6
by: Alfonso Morra | last post by:
I have written the following code, to test the concept of storing objects in a vector. I encounter two run time errors: 1). myClass gets destructed when pushed onto the vector 2). Prog throws a...
2
by: Kay | last post by:
A linked list is storing several names. I want to make a queue if I input a name that is same as the linked list. How to make each node of a linked list storing a queue that are different with each...
5
by: Phil Latio | last post by:
I have 2 virtually identical tables and wish to move data between them. Basically one table is called "live_table" and the other is named "suspended_table" and the only difference is that the...
1
by: mike | last post by:
I have a datagridview control and a button on the windows form. I am adding a new row in button click event. When the number of rows grow, the newly added row will not be visible but a scroll bar...
15
by: A. Farber | last post by:
Hello, I'm programming a web game on OpenBSD, but am also trying to keep in runnable on Linux and Cygwin. I have a list of tables at which a player/kibitzer can sit down or create a new empty...
0
by: Chris B | last post by:
Howdy, When the AddNew button is clicked on the BindingNavigator, a new row is made in the datagrid and the row selector moves to that newly created row, what is the method that moves the selector...
9
by: paragthakur | last post by:
Hi All... I m developing a collection record module. In which the invoice number field should be auto incremented.... My problem is :"How can i access the current+1 invoice number in new...
9
by: jalley06 | last post by:
Hi, I have a form on our internal intranet that has a field called Report ID. When the user clicks the print button, this number increments by one. The problem is, the newly incremented number...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.