开发者

Insert one time but 2 record on database

开发者 https://www.devze.com 2023-02-17 16:32 出处:网络
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.

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?)

0

精彩评论

暂无评论...
验证码 换一张
取 消