PHP - PHP Notice: Undefined offset

 
Vista:

PHP Notice: Undefined offset

Publicado por Miguel Antonio Fernández (2 intervenciones) el 28/05/2013 22:56:44
Hola buenas, necesito ayuda con un ejercicio en php en el que tengo que crear una tabla mdiante una funcion en php, mi codigo es el siguiente:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
function fun2($filas,$colum)
{
$a[$filas][$colum]=0;
echo ("<table border='1'>");
 
    for ($i=0;$i<$filas;$i++)
{
    echo("<tr>");
        for($j=0;$j<$colum;$j++)
{
        echo("<td width='30px'>".$a[$i][$j]."</td>");
     }
         }
 
echo("</table>");
}
fun2(10,10);
?>


El error esta en la linea 12 pero sinceramente no lo veo.
Estoy empezando ahora con esto de PHP.
Gracias de antemano.
Un saludo.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Jon

PHP Notice: Undefined offset

Publicado por Jon (27 intervenciones) el 29/05/2013 02:14:14
El ARRAY no tiene nada dentro. te menciona error por que no aya valor.
aquí te doy el resultado.

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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
function fun2($filas,$colum)
{
$a[$filas][$colum]=0;
echo ("<table border='1'>");
 
for ($i=0;$i<$filas;$i++)
{
echo("<tr>");
for($j=0;$j<$colum;$j++)
{
echo("<td width='30px'>".$a[$i][$j]."</td>");
}
}
 
echo("</table>");
}
fun2(10,10);
?>
<table border='1'><tr>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 0 in - on line 12
<td width='30px'></td><tr>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 1 in - on line 12
<td width='30px'></td><tr>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 2 in - on line 12
<td width='30px'></td><tr>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 3 in - on line 12
<td width='30px'></td><tr>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 4 in - on line 12
<td width='30px'></td><tr>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 5 in - on line 12
<td width='30px'></td><tr>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 6 in - on line 12
<td width='30px'></td><tr>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 7 in - on line 12
<td width='30px'></td><tr>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 8 in - on line 12
<td width='30px'></td><tr>PHP Notice:  Undefined offset: 9 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 9 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 9 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 9 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 9 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 9 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 9 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 9 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 9 in - on line 12
<td width='30px'></td>PHP Notice:  Undefined offset: 9 in - on line 12
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar