Why the; Warning array_push () expects parameter 1 to be array, integer given in /var/www/html/serie/editor_temporada/Make.php on line 83? [closed]

-1

Can anyone help me?

Why does this array_push($valorDeLinks[$i], $getValueLinks); snippet return 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
    
asked by anonymous 12.06.2016 / 17:37

1 answer

0

You do not need to put the index when using the array_push function. Just say which variable is your array :

array_push($valorDeLinks, $getValueLinks);
    
13.06.2016 / 09:37