[PHP] Re: mysql problems

2005-03-04 Thread Jon Drukman
Jed R. Brubaker wrote:
I have a PHP script that populates a database table. No big deal. It creates 
mailing labels. However, a weird things keeps happening - every once in a 
while, a query is run twice. It is the same query, same information, even 
the same time (there is a now() in the query - and it is identical).
create a unique index on the table so that it CAN'T possibly create 
duplicate rows.  this will cause the problematic part of your php script 
to start choking with errors about duplicate keys (assuming you're 
checking the return status of your mysql_query()'s which you should 
always be doing!!).  this should help you isolate the problem.

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


Re: [PHP] Re: mysql problems

2005-03-04 Thread Richard Lynch
Jed R. Brubaker wrote:
 Thank you both for your responces.

 Unfotuantely there is no form that instantiates this action. So the double
 submit (while a good idea), is not possible.

 As for some sample code, it is part of a rather complicated system that
 makes a number of changes but essentailly what is going on is this:

 1. Grab all items that we need to do some shipping stuff to.
 2. Foreach through the items, giving each item number to a function to
 assign it to a customer and create a mailling label.

 That simple!

 The interesting this is this - the duplicate record is inserted into the
 mailing labels queue. I can see it long before I grab the data for output
 to
 labels. Moreover, I can tell that the problem isn't in the original item
 select statement because the function (executed for each item) would have
 created different insert times in the database based on the now( ).

Show us code excerpts.

We can't second-guess from your description, as good as it is.

Pin-point the code that is doing the double insert, and print out some
debugging info there.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: mysql problems

2005-03-03 Thread Jed R. Brubaker
Thank you both for your responces.

Unfotuantely there is no form that instantiates this action. So the double 
submit (while a good idea), is not possible.

As for some sample code, it is part of a rather complicated system that 
makes a number of changes but essentailly what is going on is this:

1. Grab all items that we need to do some shipping stuff to.
2. Foreach through the items, giving each item number to a function to 
assign it to a customer and create a mailling label.

That simple!

The interesting this is this - the duplicate record is inserted into the 
mailing labels queue. I can see it long before I grab the data for output to 
labels. Moreover, I can tell that the problem isn't in the original item 
select statement because the function (executed for each item) would have 
created different insert times in the database based on the now( ).

More ideas?

Thanks!


Jed R. Brubaker [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi all -

 I could use a lead on a problem. I just don't know where to start.

 I have a PHP script that populates a database table. No big deal. It 
 creates mailing labels. However, a weird things keeps happening - every 
 once in a while, a query is run twice. It is the same query, same 
 information, even the same time (there is a now() in the query - and it is 
 identical).

 So the question is a simple one - is this a PHP problem or a MySQL 
 problem? Or somewhere in the MySQL extension? And how would I know?

 There is one clue to this otherwise vague problem. I believe that this 
 predominantly happens when the database is under an above average load.

 I would appreciate any help that I might be able to get.

 Thank you. 

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



[PHP] Re: mysql problems, need help quick

2002-06-11 Thread Shane Kelly

not on auto increment...thats the point!
why would you need to get the #6 back anyway...

this is the fundementals of database theory... chances are the database is
using this autoincrement field as the PRIMARY KEY...in which case no
duplicates are allowed..

In terms of records...your id#7 has become record #6.

I can't think of any reason why loosing the #6 should affect anything you
want to do.

XXx
Hawk [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm filling a database with info, and I'm using id as identifiers in the
 list, the id is auto increment, and I deleted one entry, now I have a hole
 in the database, is there any way to fix this?
 lets say I have
 1
 2
 3
 4
 5
 6
 And I deleted 6
 Now it looks like
 1
 2
 3
 4
 5
 7
 8
 9 and so on

 is there somewhere the next number is located ?






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