NYCPHP Meetup

NYPHP.org

[nycphp-talk] mysql freakish error!

Phil Powell soazine at erols.com
Fri Sep 5 12:26:09 EDT 2003


I have never in my life ever seen this happen, but I am doing a typical mySQL insert statement:

insert into nnet_usermetadata (
 ...
) values (
....
)

if (!mysql_query(sql)) { // DO STUFF}

the ID column field, nnet_userid, is an int auto-increment.

This is where I have never in my career seen this happen before.  The INSERT statement, upon execution, literally writes on top of another existing row, so instead of 5 or 6 rows I have only 1 row, same ID, values changed!

The way it works is that once a new user is pre-registered, their information is stored in the db, a cookie is set with their userID (the infamous permanent cookie) and then they're shown a screen w/ link to click to go to the next page.  They can then click onto the "Registrer" link and edit their pre-registration information based upon the cookie stored in their machine and submit.  Once submitted this time it updates their information instead of inserts.

I've checked my code and writing on top of an existing row should NOT happen unless a cookie is set on their machine with their userid.  In short, if I pre-register for the first time I should have a cookie with userid of 1.  If Sven pre-registers for the first time on HIS machine he should have a cookie with userid of 2.  and so on.  

So, uh, HELP!

Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030905/2824341c/attachment.html>


More information about the talk mailing list