I'd already set Debug = 3, so I'm not sure that pr made any
difference... Anyway, this is what I got. Sorry if the SQL doesn't
display clearly.
This is the SQL that Users/edit does initially:
SELECT `User`.`id`, `User`.`username`, `User`.`passwd`, `User`.`name`,
`User`.`email`, `User`.`last_visit`, `User`.`group_id`,
`User`.`active`, `User`.`created`, `User`.`modified`, `Profile`.`id`,
`Profile`.`created`, `Profile`.`modified`, `Profile`.`address_1`,
`Profile`.`address_2`, `Profile`.`address_3`, `Profile`.`county`,
`Profile`.`postcode`, `Profile`.`country`, `Profile`.`phone`,
`Profile`.`user_id` FROM `users` AS `User` LEFT JOIN `profiles` AS
`Profile` ON `Profile`.`user_id` = `User`.`id` WHERE `User`.`id` = '7'
LIMIT 1
Which produces this Data array:
[data] => Array
(
[User] => Array
(
[id] => 7
[username] => UserFive
[passwd] =>
[name] => Mrs Fifth User
[email] => [EMAIL PROTECTED]
[last_visit] => 0000-00-00 00:00:00
[group_id] => 0
[active] => 0
[created] => 2006-12-19 20:58:07
[modified] => 2007-01-03 17:35:40
)
[Profile] => Array
(
[id] => 12
[created] => 2006-12-19 20:58:07
[modified] => 2007-01-03 17:37:12
[address_1] => House No.
[address_2] => Street name
[address_3] => Town name
[county] => Cornwall
[postcode] => XX78 4XX
[country] => England
[phone] => Not applicable
[user_id] => 7
)
)
And then when Save is called, it does this:
Nr Query Error
Affected Num. rows
1 SELECT COUNT(*) AS count FROM `users` WHERE (`id` = 7) 1
1 4
2 UPDATE `users` SET `id` = '7',`name` = 'Mrs Fifth User',
`email` = '[EMAIL PROTECTED]',`modified` = '2007-01-06 12:05:03'
WHERE `id` = '7'
1 4
3 SELECT COUNT(*) AS count FROM `profiles` WHERE (`id` = 12) 1
1 4
4 UPDATE `profiles` SET `id` = '12',`user_id` = NULL,
`address_1` = 'House No.',`address_2` = 'Street name',
`address_3` = 'Town name',`county` = 'Cornwall',
`postcode` = 'XX78 4XX',`country` = 'England',`phone` = 'n/a',
`modified` = '2007-01-06 12:05:03' WHERE `id` = '12'
1 7
5 SELECT COUNT(*) AS count FROM `users` WHERE (`id` = 7) 1
1 5
6 UPDATE `users` SET `id` = '7',`name` = 'Mrs Fifth User',
`email` = '[EMAIL PROTECTED]',`modified` = '2007-01-06 12:05:03'
WHERE `id` = '7'
0 2
7 SELECT COUNT(*) AS count FROM `profiles` WHERE (`id` = 12) 1
1 2
8 UPDATE `profiles` SET `id` = '12',`user_id` = NULL,
`address_1` = 'House No.',`address_2` = 'Street name',
`address_3` = 'Town name',`county` = 'Cornwall',`postcode` = 'XX78
4XX',
`country` = 'England',`phone` = 'n/a',`modified` = '2007-01-06
12:05:03'
WHERE `id` = '12'
0 2
So the Profile is without a user_id and loses its User.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---