473,326 Members | 2,175 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,326 software developers and data experts.

problems with product registration

Hi everyone,
I have the following problem: i have 3 pages: Page1, Page2,
Page3; These pages register a product.
In Page1 i do a post to Page2. In Page2, i asynchrony upload some
images, to be used at Page2 itself, the images will be saved at the
DB, and used like: <img src="ShowImage.php?cod=1231">. Each Image has
a product associated.
If the user that will register his product, at Page2 already has
done 3 images upload, and close the web browser, what will happen? The
database will have the uploaded images, but these images will not have
a product associated, cause the user had not done the last post at
Page3!
I´ve beeing doing a research, and i realized that i could use a
transaction. But, this transaction needs a persisten connection.
I use postgresql, Did anyone knows how to solve my problem? How Can
i use a persistent connection with php? Did the persistent connection
will solve my problem?
Thanks very much
Jun 2 '08 #1
2 1266
xaviergxf wrote:
Hi everyone,
I have the following problem: i have 3 pages: Page1, Page2,
Page3; These pages register a product.
In Page1 i do a post to Page2. In Page2, i asynchrony upload some
images, to be used at Page2 itself, the images will be saved at the
DB, and used like: <img src="ShowImage.php?cod=1231">. Each Image has
a product associated.
If the user that will register his product, at Page2 already has
done 3 images upload, and close the web browser, what will happen? The
database will have the uploaded images, but these images will not have
a product associated, cause the user had not done the last post at
Page3!
I´ve beeing doing a research, and i realized that i could use a
transaction. But, this transaction needs a persisten connection.
I use postgresql, Did anyone knows how to solve my problem? How Can
i use a persistent connection with php? Did the persistent connection
will solve my problem?
Thanks very much
Persistent connections won't help you here, either. The transaction
will still be terminated at the end of your second page.

What you need to do is store the data somewhere temporarily, i.e. in
another table, then remember the key to the row. Also add a timestamp
column to tell when the data was inserted.

If the complete Page 3, fetch the data you just stored and place it in
your live tables, then delete it. Then, on a regular basis (i.e. once a
day), go through your temporary storage table and remove anything 24
hours (via a cron job), based on the timestamp you placed in the row.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #2
On Wed, 14 May 2008 19:18:56 +0200, xaviergxf <xa*******@gmail.comwrote:
Hi everyone,
I have the following problem: i have 3 pages: Page1, Page2,
Page3; These pages register a product.
In Page1 i do a post to Page2. In Page2, i asynchrony upload some
images, to be used at Page2 itself, the images will be saved at the
DB, and used like: <img src="ShowImage.php?cod=1231">. Each Image has
a product associated.
If the user that will register his product, at Page2 already has
done 3 images upload, and close the web browser, what will happen? The
database will have the uploaded images, but these images will not have
a product associated, cause the user had not done the last post at
Page3!
I´ve beeing doing a research, and i realized that i could use a
transaction. But, this transaction needs a persisten connection.
I use postgresql, Did anyone knows how to solve my problem? How Can
i use a persistent connection with php? Did the persistent connection
will solve my problem?
As you're not sure how slow your users can be (upload something, go drink
a cup of coffee, come back, and only then continue), I'd say go for the
easy route: let them sit there for a certain period of time you and your
users deem reasonably safe to assume the action is aborted, and clean your
database up with a cron job that looks for either orphan images with a
timestamp longer then X time ago.

Alternatively, you could use a database driven session, in which case the
garbage handler would take over the job mentioned for the cronjob earlier:
as soon as you think a session is timed out, the garbage collector can
delete the sessiondata and related images. Of course, loading all data of
the images in $_SESSION is not the way to go, so either store them in in
other BLOB columns of a related row if they have a fixed amount, or in a
related table, and use a foreign key delete cascade.
--
Rik Wasmus
[SPAM] Now temporarily looking for some smaller PHP/MySQL projects/work to
fund a self developed bigger project, mail me at rik at rwasmus.nl. [/SPAM]
Jun 2 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gudni G. Sigurdsson | last post by:
Hi. I am working on a program for the .NET Framework written in C# with Visual Studio .NET. With this program, one can print a report realized with the Crystal Report software included with VS...
1
by: Chris | last post by:
Hello, I have a program that uses the CInternetSession and CHttpConnection mfc classes to register the program...it works for the majority of our customers, but a few have received errors, all...
3
by: Grim Reaper | last post by:
I print mailing labels out of Access 2000 databases about 3 to 4 times a week. I have been having problems with one thing since I have been printing mailing labels. I print mailing labels by...
11
by: Paul Aspinall | last post by:
Hi Can anyone offer any hints / tips for creating registration keys / application activation, as software copy protection measures for a Winform app developed in C#? Thanks
3
by: dtvuser | last post by:
Hi, I'm new to PHP and seem to be having soom problems, I'm getting confused with all the different styles of script writing. I've created a PHP script to submit details to my email but the...
0
by: DanielP | last post by:
I'm trying to call a C# assembly from an unmanaged C++ app, but I'm having some problems. I've tracked it down to a registration problem, and a search through the registry shows that the guid I've...
2
by: Wayne Smith | last post by:
Applies to: Visual Studio 2008 Professional Hi everyone, I'm in the middle of creating a website with VS2008 and I'm trying to integrate a user registration/login section on the website but I've...
2
by: =?Utf-8?B?TWlja3lQ?= | last post by:
Ok, so I have a HP xw4200 with a valid XP Pro registration key, in fact it came on it already installed. I then bought a second-hand computer that needed Wnidows installed on, but that also had...
6
by: Wesley Peace | last post by:
I hate to cross post, but I've gotten no answer yet on a problem I'm having with visual studio 2008. I've created a series of forms with controls to access a Access database tables. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.