Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #18772
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Help With Warning Message |
| Date | 2021-08-23 01:50 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <sfuut5$lb8$1@dont-email.me> (permalink) |
| References | <7no5igtt055jqdalqa2u2vlkfeu6bvhnag@4ax.com> |
On Sun, 22 Aug 2021 20:00:04 -0400, Call Me Tom wrote: > here's the code > $query4 = "SELECT airport_name > FROM airports > WHERE airport_code = '$origin'"; > $result4 = $dbh->query($query4); > $da = $result4->FETCH(PDO::FETCH_ASSOC); > $da_name = $da['airport_name']; > > The above produces this warning message > > Warning: Trying to access array offset on value of type bool in > C:\xampp\htdocs\CAA_Tom\logbook.php on line 104 > > I don't even know where to begin. Start with looking at line 104 of the PHP code in file C:\xampp\htdocs\CAA_Tom\logbook.php > What is the warning trying to tell me? On line 104, you tried to access a variable as an array. However, that variable /is not/ an array; it is a boolean value. Thus, the array access failed. From your code snippet above, I suspect that line 104 looks like $a = $b['something']; The error message is trying to tell you that $b is not an array (and helpfully tells you that it /is/ a boolean), so it cannot resolve the array access $b['something'] As to /why/ the variable is /not/ an array, you will have to determine that for yourself. With regards to the code snippet you attached here, I CAN tell you that the PDO fetch() method returns an array on success, OR the boolean value FALSE on failure. Perhaps you need take a look at the code that initializes the suspect array named in line 104, to see if the initializer does something similar. HTH -- Lew Pitcher "In Skills, We Trust"
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help With Warning Message Call Me Tom <noemail@noemail.com> - 2021-08-22 20:00 -0400
Re: Help With Warning Message Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2021-08-23 01:50 +0000
Re: Help With Warning Message Call Me Tom <noemail@noemail.com> - 2021-08-23 01:03 -0400
Re: Help With Warning Message "J.O. Aho" <user@example.net> - 2021-08-23 09:13 +0200
Re: Help With Warning Message Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2021-08-23 18:19 +0000
Re: Help With Warning Message Call Me Tom <noemail@noemail.com> - 2021-08-23 15:26 -0400
Re: Help With Warning Message "J.O. Aho" <user@example.net> - 2021-08-24 00:33 +0200
Re: Help With Warning Message Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2021-08-23 11:47 +0000
Re: Help With Warning Message Arno Welzel <usenet@arnowelzel.de> - 2021-08-30 10:21 +0200
csiph-web