HTTP Request failed with status (canceled)

1.7k views Asked by At

i'm creating a Web Server with php and apache only, when i try to execute a connect function or validate a form, etc. the server respond with status (canceled) in chrome, see above one file who get this error.

<?php


    define( 'ROOT_DIR', dirname(__FILE__) );
    define ("DB_SERVIDOR", 'xxx.xxx.xxx.xxx');
    define ("DB_USUARIO", "root");
    define ("DB_SENHA", "passwd");
    define ("DB_NOME", "db_name");


   class Connect extends mysqli
    {
        public function __construct(){

                //@mysqli_connect (DB_SERVIDOR, DB_USUARIO, DB_SENHA, DB_NOME);
                parent::__construct (DB_SERVIDOR, DB_USUARIO, DB_SENHA, DB_NOME);


                if (mysqli_connect_errno() != 0){

                    header('Location: localhost:8000/oton_contabil/views/error_mysql.view.php?numero_erro='.mysqli_connect_errno().'&msg='.mysqli_connect_error());

                }




        }//function __construct


        public function __destruct()
        {
            if (mysqli_connect_errno() == 0){
                $this->close();
            }
        }//function __destruct




        public function listar_tabela($query, $num_td, $objetos = array()){

            $lista_tabela = array();

            $td_values = array();

            $sql = $this->query($query);// a função query() é nativa da classe mysqli



            while ($obj = $sql->fetch_array()){    




                echo "<tr>";
                    for($i = 0; $i <= $num_td; $i++ ){



                        /* Checa se o valor a ser exibido é float */
                        if(is_numeric($obj[$objetos[$i]]) == true){
                            if(strpos($obj[$objetos[$i]], '.') != false){

                                echo "<td style='text-align:right !important;'>".number_format($obj[$objetos[$i]], 2, ',', '.')."</td>"; 
                            }
                            else{
                                echo "<td style='text-align:left !important;'>".substr($obj[$objetos[$i]], 0, 100)."</td>";

                            }    
                        }
                        elseif($obj[$objetos[$i]] == '0000-00-00'){
                            echo "<td style='text-align:left !important;'></td>";
                        }
                        elseif(DateTime::createFromFormat('Y-m-d', $obj[$objetos[$i]])){

                            echo "<td style='text-align:left !important;'>".date('d/m/Y', strtotime($obj[$objetos[$i]]))."</td>";
                        }


                        else{
                            echo "<td style='text-align:left !important;'>".substr($obj[$objetos[$i]], 0, 100)."</td>";

                        }


                    }
                echo "</tr>";

            }


            $sql->close();           
        }


    }//class

    $conexao = new Connect();
    $sql = $conexao->query("select * from cadastro_cliente");
    $obj = $sql->fetch_object();
    echo $obj['cli_id'];

    echo "lalalal";
    ?>

and the print f it in chrome enter image description here

0

There are 0 answers