Flatronez
-
Posts
3 -
Joined
-
Last visited
Posts posted by Flatronez
-
-
1 hour ago, requinix said:
Those two lines assume that something exists in $cellt when it, apparently, does not. Hard to tell why or what's going on from just this code...
Is everything behaving the way you expect it to, besides the notices?
everything seems fine, I am attaching the whole code, maybe your eyes will see the bug
-
Hello, I have inherited a website, but I can't find the php version, and when I run the website on 7.4 php, I get a lot of errors, maybe you can help?
54 $st="";
55 $stno=0;
56 $cellt = array();
57 $result = sqlsrv_query($conn, " SELECT C.date, C.station, C.fuel, C.vmm, C.vol, C.fmm FROM purchase C inner JOIN (SELECT D.station, D.fuel, MAX(D.DATE) as date FROM purchase D GROUP BY D.station, D.fuel) S on C.DATE = S.date where c.fuel!='' order by c.station, c.fuel ");
58 while ($row = sqlsrv_fetch_array($result))
59 {
60 if ($row[1]!=$st)
61 {
62 //$station[$stno]="";
63 if (!empty($st))
64 {
65 for ($k=1; $k<=count($fuel); $k++)
66 {
67 if ($cellt[$k][0]==0)
68 echo'<td>-</td>';
69 elseAND
125 for ($k=1; $k<=count($fuel); $k++)
126 {
127 if ($cellt[$k][0]==0)
128 echo'<td>-</td>';
129 else
130 if ($cellt[$k][1]==0)
131 echo'<td><a href="levelFuel.php?station=' . $station[$stno] . '&fuel=' . $fuel[$k] . '&type=all">' . $cellt[$k][0] . '</a></td>';
132 else if ($cellt[$k][1]==1)
133 echo'<td class = "low"><a href="levelFuel.php?station=' . $station[$stno] . '&fuel=' . $fuel[$k] . '&type=all">' . $cellt[$k][0] . '</a></td>';
134 else if ($cellt[$k][1]==2)
135 echo'<td class = "alert"><a href="levelFuel.php?station=' . $station[$stno] . '&fuel=' . $fuel[$k] . '&type=all">' . $cellt[$k][0] . '</a></td>';
136 else if ($cellt[$k][1]==3)
137 echo'<td class = "water"><a href="levelFuel.php?station=' . $station[$stno] . '&fuel=' . $fuel[$k] . '&type=all">' . $cellt[$k][0] . '</a></td>';
138 }Notice: Undefined offset: 8 in C:\xampp\htdocs\levelMain.php on line 67
Notice: Trying to access array offset on value of type null in C:\xampp\htdocs\levelMain.php on line 67Notice: Undefined offset: 8 in C:\xampp\htdocs\levelMain.php on line 67
Notice: Trying to access array offset on value of type null in C:\xampp\htdocs\levelMain.php on line 67
Notice: Undefined offset: 7 in C:\xampp\htdocs\levelMain.php on line 67
Notice: Trying to access array offset on value of type null in C:\xampp\htdocs\levelMain.php on line 67
Notice: Undefined offset: 7 in C:\xampp\htdocs\levelMain.php on line 67
Notice: Trying to access array offset on value of type null in C:\xampp\htdocs\levelMain.php on line 67
Notice: Undefined offset: 8 in C:\xampp\htdocs\levelMain.php on line 67
Notice: Trying to access array offset on value of type null in C:\xampp\htdocs\levelMain.php on line 67
Notice: Undefined offset: 8 in C:\xampp\htdocs\levelMain.php on line 127
Notice: Trying to access array offset on value of type null in C:\xampp\htdocs\levelMain.php on line 127
Notice: Trying to access array offset on value of type null in
in PHP Coding Help
Posted
Thank you very much for help! GJ