Page 1 of 1

foreach X Server

Posted: Wed Feb 25, 2015 7:15 am
by Ldovale
hellow!

Am new to the forum, but I already share a problem I'm facing.
 
I developed a simple web application that registers schools, instructors, teachers, administrators and students, generates schedule automatically and allows you to perform online call, and some quantitative reports in order.
 
The application works locally, given problem when I went in Locaweb server, and curious is that all codes involving foreach ($ val the $ array) {} does not interpret the server and shows.
 
I'm using Mysqli versions are as follows
 
Apache Version: 2.4.9 - Documentation PHP Version: 5.5.12 - Documentation Server Software: Apache / 2.4.9 (Win64) PHP / 5.5.12 MySQL 6.5.17
 
Has anyone experienced this?
 
I'm desperate, I have to day 02/03 to deliver.

Re: foreach X Server

Posted: Wed Feb 25, 2015 7:17 am
by Celauran
Can you post the code that isn't working as well as a description of what is happening? Just telling us that some random code "isn't working" is, unfortunately, not very helpful.

Re: foreach X Server

Posted: Wed Feb 25, 2015 7:28 am
by Ldovale
Celauran wrote:Can you post the code that isn't working as well as a description of what is happening? Just telling us that some random code "isn't working" is, unfortunately, not very helpful.
Ok,

Another thing, on the problem of foreachs, say that the array has five records, I ride a select with these records, the server comes to creating the five <options> but not behind the records, since depurei the result of the query, including, if I use while ($ rowset = mysqli_fetch_assoc ($ date)) {} shows ok.

Code: Select all

$insercao = DBinsercoes('turmas', $arr_strings, $arr_integers);
    if($insercao == 1){   

        $idAtividade = DBquery(" SELECT id, instrutor FROM t WHERE part ='".$guard_alunos."' AND nometurma = '".$nomeTurma."'" );        

        $idAtividade = mysqli_fetch_assoc($idAtividade);       

        if($alunosOption){
        
            for($i=0; $i<count($alunosOption); $i++){
                $Pessoa = DBquery(" SELECT idpessoa, nomeFROM pess WHERE idpessoa = ".$alunosOption[$i]);

                $dados = (mysqli_fetch_assoc($Pessoa));

//-------------------------------------------------------------------------------------------------------------
                    $timestamp1 = strtotime($inicioatividade);
                    $timestamp2 = strtotime( $fimatividade );

                    $cont = 1;

                    while ( $timestamp1 <= $timestamp2 )
                    {
                        //date_default_timezone_set("America/Bahia");
                        $dat = date('Y-m-d', $timestamp1); 

                        foreach ($optiondias as $vl){
                        $ic=1;
                        if($vl == date("D", $timestamp1) ){                                                    
                           $ic++;                         
                        $guard = "INSERT INTO frequencia (idturma, idinstrutor, idpessoa, datapresenca, presenca, obs)"
                        . "VALUES (".$idAtividade['idturma'].",".$instrutor.",".$dados['idpessoas'].",'".$dat."',0,'vazio')";
                        $ret = DBquery($guard);
                                    
                       }
                    }
                $timestamp1 += 86400;    
                $cont++;
                //var_dump(getdate($timestamp1));
                    }