My database is MySQL and I use PHP as my language. I wrote a function and I run my update or insert query with this function. This function is working for all of my queries and it seems ok.
At moment for one of my Tables when I insert a value I got record on my database!! I checked my function and it runs only for one time (in beginning of my function I used echo $myquery
and it wrote my query for one time) but in my database I got 2 records.
Do you have any idea about this problem?
Field---Type---Attribut开发者_StackOverflowes---Null
eventsID---int(10)---UNSIGNED---NO
auserID---int(10)---UNSIGNED---No
bUserID---int(10)---UNSIGNED---No
type---smallint(5)---UNSIGNED---No
amount---int(10)---UNSIGNED---No
cType---tinyint(3)--- ---No
cAmount---int(10) ---UNSIGNED---No
dateTime---timestamp---ON UPDATE CURRENT_TIMESTAMP---No---CURRENT_TIMESTAMP
the reason is pretty obvious. your script being executed twice per request.
most of time it occurs from lame implementation of SEO urls using mod_rewrite as a 404 handler.
Are you sure this is not running twice via 2 calls?
Echoing you're query will only only echo it once - but it could be called twice.
Perhaps try logging something as far down as you can? (At execution level?)
精彩评论