PDA

View Full Version : Update mysql mistery


UD2006
11-06-2009, 10:32 AM
I have created a contact database. When a new contact is being add, it also gets a unique random generated id. This works fine, even searching for the contact works fine, but when I come to the update part a mistery is starting.

When I want to update a contact, I get a normal message that the contact is updated (still so far so good), but when I search for the contact again, I suddenly get 2 records (same contact) but when a new random generated id, this is the mistery because the code (or page) where the random generated code is on, isn't even being called. I've checked the whole edit page (where the update query is on), but I couldnt find why the contact is getting a new random generated id.

Can someone please help me with this.

The code for the search page and the edit page (wijzigen.php) are both in the attachment (together in 1 text file)

UD2006
11-06-2009, 01:21 PM
SOLVED: I checked the code and the mysql database a bit closer and found out that I had 2 tables with the id column in both of the tables with the same name, this was causing the query (join) to make a mess.

I found out that it should had something to do with the id because I have a text field (id) hidden and when I unhide it, it showed me not the id of the current contact but a different id.

When I renamed 1 column, the id became the 1 of the contact, so problem solved.