Problems with databases in godaddy

0

I am trying to upload an online shopping site in godaddy, the problem here is that some parts of the web pages connect to the database and others do not, it can be said that the site works well on the local server of my computer and in a free hosting that I used to test the site.

for example: This section shows nothing

                    <?php 
                        include("panel_de_control/conexion.php");
                        $sql="SELECT id FROM panel_1";
                        $result=mysqli_query($con,$sql);
                        $rowcount=mysqli_num_rows($result);
                    ?>

                    <script type="text/javascript">
                    var cantidad = '<?php echo $rowcount;?>';

                        <?php    
                        $query = "SELECT * FROM panel_1";    
                        $res = mysqli_query($con,$query);
                        ?> 

                        <?php
                            while ($registro = mysqli_fetch_array($res)){
                        ?>
                        var ide = '<?php echo $registro['id'];?>';
                        var nom = '<?php echo $registro['nombre'];?>';  
                        var imagen = '<?php echo $registro['imagen'];?>';
                        var link1 = '<?php echo $registro['link'];?>';
                        <?php
                                $des =   $registro['descripcion'];
                                $rest = substr($des, 0, 50);    
                                $reemp = str_replace("\r\n", "</br>", $rest);   
                        ?>
                        var descri = <?= json_encode($reemp);?>;
                        var categoria = '<?php echo $registro['categoria'];?>';

                        if(categoria == "comp")
                                {
                        $('#sec1').append('<div id="box" name="' + categoria +'" value="' + ide + '">' +
                                        '<a href="' + 'comprar.php?' + "idee" + '=' + ide +  "&" +"categoriae" + '=' + categoria + '" style="color: #666;">' +
                                        '<div id="add_here">' +
                                            '<div id="container">' +
                                                    '<img src="panel_de_control/uploads/' + imagen + '" style="width:60%;display: block;margin-left: auto;margin-right: auto;" />' + 
                                            '</div>' +
                                            '<div style="width: 100%;height: 5%;text-align: center;float:left;">' + '</div>' +
                                            '<div style="width: 100%;height: 10%;text-align: center;float:left;color:#333">' +
                                                    nom + '<br>' +
                                            '</div>' + 
                                            '<div style="width: 10%;height: 10%;float:left;">' +
                                            '<p style="font-size:0.9em;color:#373737;">&nbsp;&nbsp;Descripción</p>' +
                                            '</div>' +
                                            '<div style="width: 100%;height: 5%;float:left;">' +
                                                '<div style="width: 10%;height: 100%;float:left;">' + '</div>' + 
                                                '<div style="width: 85%;height: 100%;float:left;line-height:1.15;font-size:0.8em;">' + 
                                                        descri + '...' + '<br>' +
                                                '</div>' + 
                                                '<div style="width: 5%;height: 100%;float:left;">' + '</div>' +     
                                            '</div>' + 

                                        '</div>' +
                                        '</div>' +
                                        '</a>' + 
                                        '<div style="width: 1%; height: 200px; float: left;"></div>');
                        }
                        <?php
                            }
                            mysqli_close($con);
                        ?>
                    </script> 

This section if you connect and show the data

                    <?php 
                        include("panel_de_control/conexion.php");
                        $sql="SELECT id FROM panel_1";
                        $result=mysqli_query($con,$sql);
                        $rowcount=mysqli_num_rows($result);
                    ?>
                    <script type="text/javascript">
                        var cantidad = '<?php echo $rowcount;?>';

                        <?php    
                        $query = "SELECT * FROM panel_1";     
                        $res = mysqli_query($con,$query);
                        ?> 

                        <?php
                            while ($registro = mysqli_fetch_array($res)){
                        ?>
                                var ide = '<?php echo $registro['id'];?>';
                                var des = '<?php echo $registro['nombre'];?>';
                                var categoria = '<?php echo $registro['categoria'];?>';
                                if(categoria == "video")
                                {
                                $('#seccion5').append('<li style="width:30%; float:left;"><a href="' + 'comprar.php?' + "idee" + '=' + ide +  "&" +"categoriae" + '=' + categoria + '">- ' + des + '</a></li>');
                                }
                        <?php
                                }
                                mysqli_close($con);
                        ?>
                    </script>

I would be very grateful if you could help me with some observation in the code or any recommendation.

    
asked by jonathancuento 25.07.2018 в 07:13
source

0 answers