Notice: Uninitialized string offset: 1
Hallo,
Ik krijg steeds de melding: Notice: Uninitialized string offset: 1 in C:\xampp\htdocs\status.php on line 77
Ik krijg met geen mogelijkheid de melding weg.
Hopelijk kunnen jullie mij helpen.
GrtZ Evert
Hier is het script.
<meta http-equiv="Refresh" content="10;URL=status.php">
Ik krijg steeds de melding: Notice: Uninitialized string offset: 1 in C:\xampp\htdocs\status.php on line 77
Ik krijg met geen mogelijkheid de melding weg.
Hopelijk kunnen jullie mij helpen.
GrtZ Evert
Hier is het script.
<meta http-equiv="Refresh" content="10;URL=status.php">
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
// uitlezen syteemfunctie
$File = "System.txt";
$fh = fopen($File, 'r');
$Dt = fgets($fh);
fclose($fh);
echo "<font color='white'>";
echo "<table border=\"0\" align=\"left\">";
echo "<tr><th>IO-nr</th>";
echo "<th> Status </th></tr>";
for ($counter = 0 ; $counter <= 15 ; $counter += 1)
{
// *****************************************op onderstaande blijft ie hangen *******************;
$Ps = $Data[$counter];
// **********************************************************************************************;
$c=$counter+1;
$File='poort' .$c. '.txt';
$fh = fopen($File, 'r');
$Data = fgets($fh);
fclose($fh);
if ( $Ps == 1 )
{
$onoff='<img src="../images/img0007.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
else
{
$onoff='<img src="../images/img0008.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
If ($Dt == 0)
{
$onoff='<img src="../images/img0009.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
echo "<tr><td>";
echo chr(32);
echo $counter+1;
echo "</td><td>";
echo chr(32);
echo $onoff;
echo "</td></tr>";
}
echo "</table>";
?>
// uitlezen syteemfunctie
$File = "System.txt";
$fh = fopen($File, 'r');
$Dt = fgets($fh);
fclose($fh);
echo "<font color='white'>";
echo "<table border=\"0\" align=\"left\">";
echo "<tr><th>IO-nr</th>";
echo "<th> Status </th></tr>";
for ($counter = 0 ; $counter <= 15 ; $counter += 1)
{
// *****************************************op onderstaande blijft ie hangen *******************;
$Ps = $Data[$counter];
// **********************************************************************************************;
$c=$counter+1;
$File='poort' .$c. '.txt';
$fh = fopen($File, 'r');
$Data = fgets($fh);
fclose($fh);
if ( $Ps == 1 )
{
$onoff='<img src="../images/img0007.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
else
{
$onoff='<img src="../images/img0008.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
If ($Dt == 0)
{
$onoff='<img src="../images/img0009.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
echo "<tr><td>";
echo chr(32);
echo $counter+1;
echo "</td><td>";
echo chr(32);
echo $onoff;
echo "</td></tr>";
}
echo "</table>";
?>
Gewijzigd op 11/09/2013 19:29:08 door Evert Kaa
En welke regel is regel 77, aangezien bovenstaande code maar 70 regels heeft?
Ik denk, maar dat is een wilde gok, dat het fout gaat bij regel 61...
Ik denk, maar dat is een wilde gok, dat het fout gaat bij regel 61...
on line 77
En welke regel is dat?
Toevoeging op 11/09/2013 19:35:54:
$Data[1] bestaat blijkbaar niet.
En welke regel is dat?
Toevoeging op 11/09/2013 19:35:54:
$Data[1] bestaat blijkbaar niet.
Heel $Data bestaat nog niet in de eerste aanroep van de for loop. Op regel 35 staat wel $Data = fgets($fh); maar in de eerste loop is hij daar nog niet geweest.
Erwin H op 11/09/2013 20:08:13:
Heel $Data bestaat nog niet in de eerste aanroep van de for loop. Op regel 35 staat wel $Data = fgets($fh); maar in de eerste loop is hij daar nog niet geweest.
Scherp gezien.
Probleem opgelost lijkt mij.
HAllo,
Inderdaad,ik heb het aangepast en het werkt nu.
thanx
</body>
</html>
Inderdaad,ik heb het aangepast en het werkt nu.
thanx
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
// uitlezen syteemfunctie
$File = "System.txt";
$fh = fopen($File, 'r');
$Dt = fgets($fh);
fclose($fh);
echo "<font color='white'>";
echo "<table border=\"0\" align=\"left\">";
echo "<tr><th>IO-nr</th>";
echo "<th> Status </th></tr>";
for ($counter = 0 ; $counter <= 15 ; $counter += 1)
{
$c=$counter+1;
$File='poort' .$c. '.txt';
$fh = fopen($File, 'r');
$Data = fgets($fh);
fclose($fh);
if ( $Data == 1 )
{
$onoff='<img src="../images/img0007.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
else
{
$onoff='<img src="../images/img0008.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
If ($Dt == 0)
{
$onoff='<img src="../images/img0009.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
echo "<tr><td>";
echo chr(32);
echo $counter+1;
echo "</td><td>";
echo chr(32);
echo $onoff;
echo "</td></tr>";
}
echo "</table>";
?>
// uitlezen syteemfunctie
$File = "System.txt";
$fh = fopen($File, 'r');
$Dt = fgets($fh);
fclose($fh);
echo "<font color='white'>";
echo "<table border=\"0\" align=\"left\">";
echo "<tr><th>IO-nr</th>";
echo "<th> Status </th></tr>";
for ($counter = 0 ; $counter <= 15 ; $counter += 1)
{
$c=$counter+1;
$File='poort' .$c. '.txt';
$fh = fopen($File, 'r');
$Data = fgets($fh);
fclose($fh);
if ( $Data == 1 )
{
$onoff='<img src="../images/img0007.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
else
{
$onoff='<img src="../images/img0008.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
If ($Dt == 0)
{
$onoff='<img src="../images/img0009.png" id="Image1" alt="" border="0" style="width:20px;height:20px">'."<br />";
}
echo "<tr><td>";
echo chr(32);
echo $counter+1;
echo "</td><td>";
echo chr(32);
echo $onoff;
echo "</td></tr>";
}
echo "</table>";
?>
</body>
</html>
Gewijzigd op 12/09/2013 07:32:54 door Evert Kaa




