Hey all,
I've recently run into a "bug". I have a script that, among other things, inserts a row into my MySQL database using PHP.
9/10 times it either inserts 2 or 3 rows. I couldn't figure it out, and I searched the web hoping that someone else had run into this problem. Sure enough, here's what I came up with:
Now if you check out one of the links that's supposed to "explain the problem", it refers to some bullcrap about bgcolor. Now I don't have this bgcolor stuff going on in my code. But I also read in that webpage that it may have something to do with broken html and that's what's causing the page to load more than once.
I still don't know what the problem is with my code (And there's too much of it to post here...), but I don't see any broken html.
I even inserted some javascript to popup an alert when it was attempting to do the insert, hoping that it would popup more than once if it was in fact reloading the page. Well, it only popped up once, and I had 3 new rows inserted!!
So my temporary solution is to create a second query, and check to see that my previous insert hadn't gone through. In effect I'm doing a select previous to my insert.
I don't know what I'm trying to say here, but at the very least, if you do run into this problem, here's a quick fix for it. Hopefully it's applicable for your situation.
Cheers,
Sadiq.
I've recently run into a "bug". I have a script that, among other things, inserts a row into my MySQL database using PHP.
9/10 times it either inserts 2 or 3 rows. I couldn't figure it out, and I searched the web hoping that someone else had run into this problem. Sure enough, here's what I came up with:
Now if you check out one of the links that's supposed to "explain the problem", it refers to some bullcrap about bgcolor. Now I don't have this bgcolor stuff going on in my code. But I also read in that webpage that it may have something to do with broken html and that's what's causing the page to load more than once.
I still don't know what the problem is with my code (And there's too much of it to post here...), but I don't see any broken html.
I even inserted some javascript to popup an alert when it was attempting to do the insert, hoping that it would popup more than once if it was in fact reloading the page. Well, it only popped up once, and I had 3 new rows inserted!!
So my temporary solution is to create a second query, and check to see that my previous insert hadn't gone through. In effect I'm doing a select previous to my insert.
I don't know what I'm trying to say here, but at the very least, if you do run into this problem, here's a quick fix for it. Hopefully it's applicable for your situation.
Cheers,
Sadiq.
Comment