RE: Random data loss.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Could be a problem of multiple update modules for the same table.  When I've
encountered this problem in the past it's been one of two causes.

1.  In the process of maintaining the table one routine that has no price
information, retrieves the row and notices that the something needs to be
changed, and instead of only updating columns that have changed it seeks to
update all of them (perhaps satisfying one programmers sense of order), and
since it has no price info, it replaces the price with zero (good rule IMHO;
only update columns that you know need to be changed).

2.  Update queries that did not specify all the appropriate where clauses,
thereby updating multiple rows, and perhaps in this case updating with zero
prices (perhaps contributed to by coding all elements as above).  (a rule
that I apply to myself, not necessarily quite as good as the previous rule,
use artificial keys [auto increment fields] and update with unique [or a
list of] artificial key in the where clause).  One nice thing about auto
increment primary keys is they are self locking in that no two insert rows
can get the same artificial key, even if the insert occurs at the same time
(at least in MySQL).  Take a look at the text in your actual queries and
read them over and over, the answer is there.

Don't consider this an exhaustive list, there are lots of people out there
more clever than I coming up with new ways to loose data every day.  But
this is where I would start.

Hope this helps,

Warren Vail

> -----Original Message-----
> From: 2wsxdr5 [mailto:2wsxdr5@xxxxxxx] 
> Sent: Monday, December 06, 2004 4:27 PM
> To: php-general@xxxxxxxxxxxxx
> Subject:  Random data loss.
> 
> 
> With out posting any code I was wondering if anyone here has been 
> experiencing this kind of problem.  I have a standard web 
> from that PHP 
> code then reads and saves the data into a MySQL DB.  The 
> problem is some 
> of my users have had data lost somewhere in this process.  
> The web site 
> is www.thewishzone.com.  It is a wish list site and the data 
> that seems 
> to be getting lost is the price of an item a user adds to their wish 
> list.  I can't seem to duplicate it here.  However one user 
> did have it 
> happen twice in a short time period.  They enter a valid 
> price and after 
> the record posts the price goes to zero.  Any ideas?
> 
> Chris W
> 
> Gift Giving Made Easy
> Get the gifts you want & give the
> gifts they want this holiday season
> http://thewishzone.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux