0
Can someone help me?
Why this passage array_push($valorDeLinks[$i], $getValueLinks);
Return me a Warning?
array_push() expects Parameter 1 to be array, integer Given in /var/www/html/serie/editor_temporada/Make.php on line 83
63 //Obtendo valor de links-----------------------------------------------
64 $valorDeLinks = array();
65 $urlDeLinks = array();
66
67 for ($i = 0; $i < $nomeDasTabelas['value']; $i ++) {
68 $getValueLinks = 0;
69
70 $obtendo = mysqli_query($conect, "SELECT * FROM $nomeDasTabelas[$i]");
71 if ($obtendo != true) {
72 $log = $log . "<script>console.log('Falha ao consultar a DATABASE -Obtendo tabelas da serie-)</script>";
73 } else {
74 $urlDeLinks[$i] = array();
75 $valorDeLinks[$i] = 0;
76
77 while ($dados = $obtendo->fetch_array()) {
78
79 array_push($urlDeLinks[$i], $dados['link']);
80 $getValueLinks ++;
81 }
82 var_dump($valorDeLinks[$i]);
83 array_push($valorDeLinks[$i], $getValueLinks);
84 }
85 }
86 print_r($urlDeLinks); //OK
87 print_r($valorDeLinks); //array_push() expects parameter 1 to be array, integer given in /var/www/html/serie/editor_temporada/Make.php on line
Why the
$i
here$urlDeLinks[$i]
? It should just bearray_push($urlDeLinks, $dados['link']);
– Sergio
Believe me, I’ve mistaken it for an array. So I don’t need to initialize it with
$valorDeLinks[$i] = 0;
?– ayelsew
You’re already initializing with
$urlDeLinks = array();
, unless you want arrays inside arrays.– Sergio
Thank you very much!!
– ayelsew
Worked the way you wanted?
– Sergio