Ive been trying to get my forst rials program to update and delete records ina mysql database and I've been experiencing this weird problem where no errors are thrown up the data doent get updated/deleted.
Ive rtaced the problem down to the fact that the ID for the record to be updated or deleted is not being passed properly. But theer doesnt seem to be any way of making ti work correctly.
EG: from logfile
Processing UsersController#update (for 134.225.101.126 at 2008-06-12 12:15:42) [PUT] Session ID: BAh7BzoMY3NyZl9pZCIlODNmNzY3YWRhMzQ5MWU3YjY5YmYyZDM5MTU4Nzc0%0ANzkiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh%0Ac2h7AAY6CkB1c2VkewA%3D--67019028005bd54bb3a0ff18a2c6acfb4ad8941b Parameters: {"user"=>{"Staff"=>"1", "MscInfo"=>"0", "HdrForum"=>"0", "Internal_Sort"=>"", "Lab"=>"0", "Secs"=>"0", "UgBoard"=>"0", "Personal_Web"=>"~arrdvariusmaximus", "UgVis"=>"0", "ProbationDate"=>"", "LineManager"=>"", "BscInfo"=>"0", "PhdSuper"=>"1", "Security"=>"0", "SurName"=>"Aaardvark123", "HdrBoard"=>"0", "Research"=>"1", "Title"=>"Mr", "EMail"=>"a.aardvark@website.com", "ForeName"=>"Aaalan", "Year"=>"", "Cracks"=>"0", "InfoSec"=>"0", "RetirementDate"=>"", "PhoneNo"=>"1111", "Mats"=>"0", "Media"=>"1", "PhdInfo"=>"0", "ResearchGroup"=>"", "Position_Group"=>"Ardvar Asimilation", "Duties"=>"Arythmia", "Group_Web"=>"~ard", "Course"=>"", "Teapot"=>"0", "StartDate"=>"", "EndDate"=>"", "FundingBody"=>"", "ImageName"=>"noimage.gif", "RoomNo"=>"A102", "PayCategory"=>""}, "commit"=>"Update", "authenticity_token"=>"428c0c3d4d97925d4b6de702b6b65a30b58963b2", "_method"=>"put", "action"=>"update", "id"=>"1223", "controller"=>"users"} e[4;36;1mUser Columns (0.013565)e[0m e[0;1mSHOW FIELDS FROM `users`e[0m e[4;35;1mUser Load (0.011418)e[0m e[0mSELECT * FROM `users` WHERE (`users`.`id` = '1223') e[0m e[4;36;1mSQL (0.000467)e[0m e[0;1mBEGINe[0m e[4;35;1mUser Update (0.000980)e[0m e[0mUPDATE `users` SET `UgVis` = 0, `LineManager` = '', `Staff` = 1, `Position_Group` = 'Ardvar Asimilation', `Group_Web` = '~ard', `Duties` = 'Arythmia', `Title` = 'Mr', `UgBoard` = 0, `Secs` = 0, `Year` = '', `RetirementDate` = '', `MscInfo` = 0, `PayCategory` = '', `ImageName` = 'noimage.gif', `Security` = 0, `BscInfo` = 0, `Personal_Web` = '~arrdvariusmaximus', `Internal_Sort` = '', `Teapot` = 0, `FundingBody` = '', `EndDate` = '', `SurName` = 'Aaardvark123', `Research` = 1, `ResearchGroup` = '', `PhoneNo` = '1111', `PhdInfo` = 0, `Media` = 1, `Mats` = 0, `PhdSuper` = 1, `InfoSec` = 0, `ForeName` = 'Aaalan', `Cracks` = 0, `ProbationDate` = '', `RoomNo` = 'A102', `EMail` = 'a.aardvark@website.com', `Lab` = 0, `StartDate` = '', `Course` = '', `ID` = 1223, `HdrBoard` = 0, `HdrForum` = 0 WHERE `id` = NULLe[0m e[4;36;1mSQL (0.000295)e[0m e[0;1mCOMMITe[0m Redirected to http://website/users/users/ Completed in 0.09493 (10 reqs/sec) | DB: 0.02672 (28%) | 302 Found [http://website/users/users/1223\]
As you can see in the first instance of generated SQL the ID is preserved
SELECT * FROM `users` WHERE (`users`.`id` = '1223'
but in the actual UPDATE line its getting WHERE `id` = NULL
Any ideas why this might be happening? I'm using MySQL on Apache with fastcgi