473,797 Members | 3,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Database getting updated twice

Hey all,

Another question for you.

I have a script that reads in a row from my db into an image object
which i defined. It then takes that image and generates a thumbnail by
using an output buffer and writes the thumbnail to a new entry in the
database. Finally it prints the new image to the screen via this
method:

header("Content-type: ".$image->GetFileType()) ;
header("Content-length: ".$this->GetFileSize()) ;
echo $this->GetImageConten t();

where GetImageContent returns the binary data contained in the image.

This all seems to work, but when it hits the first header line
header("Content-type: ".$image->GetFileType()) ;

it adds a second entry into the database. Basically im ending up with 2
identical records.

Ive been trying to figure out how to work around this, and the only
thing i could think of was that because im calling to header the script
is getting executed twice. No where in my print function so i have a
call to save so my question i suppose is, is it possible for a script
to execute a second time because of a call to header?

Apr 17 '06 #1
2 1201
Areric wrote:
Hey all,

Another question for you.

I have a script that reads in a row from my db into an image object
which i defined. It then takes that image and generates a thumbnail by
using an output buffer and writes the thumbnail to a new entry in the
database. Finally it prints the new image to the screen via this
method:

header("Content-type: ".$image->GetFileType()) ;
header("Content-length: ".$this->GetFileSize()) ;
echo $this->GetImageConten t();

where GetImageContent returns the binary data contained in the image.

This all seems to work, but when it hits the first header line
header("Content-type: ".$image->GetFileType()) ;

it adds a second entry into the database. Basically im ending up with 2
identical records.

Ive been trying to figure out how to work around this, and the only
thing i could think of was that because im calling to header the script
is getting executed twice. No where in my print function so i have a
call to save so my question i suppose is, is it possible for a script
to execute a second time because of a call to header?


So, what does your GetFileType() function do?
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Apr 17 '06 #2
just returns $this->mFileType; where mFileType is a string value along
the lines of "image/jpeg"

Apr 17 '06 #3

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

Similar topics

2
2935
by: lawrence | last post by:
A very strange bug. www.monkeyclaus.org is run by a cms I'm developing. One of types of users we allow is "justTestingTheSite", a type of user I developed to give demo's to prospective clients. The purpose of this level of security is to let someone log in and see everything as if they were root, and yet not be able to update or delete anything, as they have no real priveledges at all. I just logged in as root and created such an...
10
1659
by: Preston Crawford | last post by:
I'm looking to learn ASP.NET better and thinking about helping my church put together a website in order to do this. They need the help, I'd like the training, so I'm thinking of going this route to solve their needs. I'm wondering, though, if there are any hosts out there that do domain hosting that support ASP.NET and database connectivity without charging you an arm and a leg. And by database connectivity I don't mean Access, but rather...
2
1654
by: Bill Moran | last post by:
Hello again, I'm developing a program based on PostgreSQL. It's consists of tables, constraints, _many_ stored procedures, 56M of test data, and a client app written in C. To help me with all of this, I obviously have a Makefile. I can do "make" to rebuild the C app (assuming I haven't added any bugs) and I can do "make database" to create the database tables, and "make funcitons" to add the stored procedures to the database, and...
25
2567
by: Colin McKinnon | last post by:
Hi all, There's lots of DB abstraction layers out there, but a quick look around them hasn't turned up anything which seems to met my requirements. Before I go off and write one I thought I'd ask here if anyone knows of such a beast... I want some code where I present an array of data, and the corresponding primary key and let the code work out whether to INSERT or UPDATE it, I also want to be able to present the data from a QBF or...
8
1939
by: rdemyan via AccessMonster.com | last post by:
Anyone have any ideas on how to determine when the back-end file (containing only tables) has been updated with new data. The date/time of the file won't work because it gets updated to the current date/time when the back-end file is compacted. I'm just looking for an easy way to determine when there has been a change to data in any table in the back-end file. Maybe something is updated in one of the system tables??
2
1435
by: Sue | last post by:
Hi, we are thinking of installing sql server as a backend to our website. Q.1. What is the best way to do this - should we host the database on the same IIS server where the website is hosted, or would it be better to put the database on a server on it's own, separate from the IIS server? Q.2. Also what is the best way for clients to connect to the database for querying purposes - will I be able to install client versions of
2
3245
by: =?Utf-8?B?SGV6YWw=?= | last post by:
Hi, I am trying to add a new record to a table but everytime I click the button, somehow it saves the record twice... I've created a stored procedure to insert records into a table and I called that procedure in the code that I attached to a button click. Here is the event handler code which is created automatically: this.AddCustomer.Click += new System.EventHandler(this.AddCustomer_Click); I checked the stored procedure and the code...
2
1911
by: CommonElements | last post by:
Hi, 1. I am using Visual Studio.NET 2005 C# Win Form 2. I have setup a database connection to my Access Database using ADO.NET 3. On my system timer I have the following code to execute every 1 sec: private void timer1_Tick(object sender, EventArgs e) { OleDbConnection myConnection = new OleDbConnection(myConnectionString); OleDbCommand myCommand = new OleDbCommand("SELECT *FROM Lights_Settings", myConnection);
0
4760
MrMancunian
by: MrMancunian | last post by:
How to create a database connection without using wizards Introduction I've seen a lot of questions on the net about getting data from, and saving data to databases. Here's a little insight how to do that using .NET code. I prefer using code instead of wizards, because you are completely in charge of connections. This article is written for both Visual Basic.NET 2005 and C# 2005 and will discuss how to use an MS Sql database. OleDB works...
0
9537
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,...
1
10209
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9066
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
7560
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
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
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
3750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2934
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.