/    Sign up×
Community /Pin to ProfileBookmark

Catch Error on Loop

I’m looping through my database records, thousands of records. I’m calling a number of methods which return calculations etc. I then do conditional statements based on these.

Any who, from the several thousand records I’m getting about 100 rows of this error which is from within one of the methods used.

Notice: Trying to access array offset on value of type null in

The line number comes from within my try statement.

I’ve tested the code on loads of random rows and it works so there’s just a few failing for an unknown reason.

I need to isolate these. I tried the try catch block but it doesn’t work. Any ideas for how I can catch the exact rows?

“`
try{
// do my checks

} catch (exception $e){
error_log($rowID. ‘ : ‘ . $e);
}
“`

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmJan 23.2022 — That's not much code to work with. Not even any array with an offset
Copy linkTweet thisAlerts:
@kiwisauthorJan 23.2022 — @ginerjm#1641835

My question is more around how to isolate or catch errors deep within loops.

but don't worry I've isolated the error.
×

Success!

Help @kiwis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...