Welcome Guest, Not a member yet? Register   Sign In
Logic with multiple queries
#11

[eluser]DarkManX[/eluser]
np, ur welcome. i like ppl who ask why they should do something a certain way and not just going it. you should use transactions when it gets complicated. to track that one user_id to deleted it is no problem. but imagine, you are inserting like 2000 data-rows with many relationsships and many different table: you also could just track all the id's of the rows you inserted and deleted them after something goes wrong, but you will need to impliment some kind of logging logic. in that case you - ofc - would use transactions.
#12

[eluser]xtremer360[/eluser]
I understand that completely now, however if that's the case I would be having an issue with figuring out the logic of handling this my logic because what if the database user DOES NOT have DELETE privileges.
#13

[eluser]xtremer360[/eluser]
I say this because I ran the code I showed in post #2 and got this error message and don't understand it.

Code:
<p>Error Number: 1452</p><p>Cannot add or update a child row: a foreign key constraint fails (`xtremer_kowmanager`.`users`, CONSTRAINT `users_ibfk_3` FOREIGN KEY (`user_roles_id`) REFERENCES `user_roles` (`user_role_id`) ON DELETE NO ACTION ON UPDATE NO ACTION)</p><p>INSERT INTO `users` (`username`, `password`, `password_hash`, `first_name`, `last_name`, `email_address`) VALUES ('xtremer360', 'c1b6cea331a8ea71d898c665786eca4500c73a57', '5e0b594d292', 'Jeffrey', 'Davidson', '[email protected]')</p><p>Filename: /home/xtremer/public_html/kowmanager/modules/users/models/users_model.php</p><p>Line Number: 65</p> </div>
#14

[eluser]DarkManX[/eluser]
dont get your point. never used privileges for mysql.
#15

[eluser]xtremer360[/eluser]
The issue was fixed due to the fact I had to have a default value set up for the user_role_id field in the database.




Theme © iAndrew 2016 - Forum software by © MyBB