tryon Posted October 13, 2022 Share Posted October 13, 2022 Please where am i getting the error. am new on here pls help me out. $ClientCOUNTRY=getLocationInfoByIp($decClientIP)['country']; $ServerCOUNTRY=getLocationInfoByIp($decServerIP)['country']; Quote Link to comment https://forums.phpfreaks.com/topic/315418-php-warning-trying-to-access-array-offset-on-value-of-type-bool/ Share on other sites More sharing options...
ginerjm Posted October 13, 2022 Share Posted October 13, 2022 (edited) You have parens where you should have brackets Edited October 13, 2022 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/315418-php-warning-trying-to-access-array-offset-on-value-of-type-bool/#findComment-1601575 Share on other sites More sharing options...
mac_gyver Posted October 13, 2022 Share Posted October 13, 2022 the getLocationInfoByIp() function call is returning a boolean (probably a false value), so the array dereferencing of the returned value, e.g. the ['country'] element, is also failing. you would need to determine why the function call is failing. you also always need error handling for statements that can fail so that your code doesn't attempt to use non-existent data. Quote Link to comment https://forums.phpfreaks.com/topic/315418-php-warning-trying-to-access-array-offset-on-value-of-type-bool/#findComment-1601576 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.