Welcome Guest, Not a member yet? Register   Sign In
update(null,$data)
#1

Hello,
just found something weird in CI4.
if my $id = null then the mysql update($id,$data) will update all the lines in the table.

Is that normal?
Reply
#2

This is by design to allow one-time "global" updates, as discussed here and an attempt to change this behavior in here. Since this behavior is quite risky, you should put the necessary guards such that the primary ID you will be passing to update is not empty. By empty I mean anything considered by PHP as empty, such as null, false, or an empty string.
Reply
#3

(This post was last modified: 05-19-2021, 02:42 AM by moammad khalid.)

no body can help in this platform because i had a post but still waiting to reply from anyone.
Reply
#4

(05-18-2021, 10:06 AM)paulbalandan Wrote: This is by design to allow one-time "global" updates, as discussed here and an attempt to change this behavior in here. Since this behavior is quite risky, you should put the necessary guards such that the primary ID you will be passing to update is not empty. By empty I mean anything considered by PHP as empty, such as null, false, or an empty string.
thank you
Reply




Theme © iAndrew 2016 - Forum software by © MyBB