Images saved in the BD and in the project root folder do not appear on the site

Asked

Viewed 75 times

0

I’m progressing on a website , using the php language in netbeans and easyphp p database. the site registers companies and services and also it is possible to search by name the same. (It is in development process)

by clicking on the image it seems the error:

You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near 'codigo_EMPRESA']? >'' at line 1

lines of code:

search company and index class:

class Search Company:

<?php
require_once "EmpresasDAO.php";
$objBDEmpresas = new EmpresasDAO();
// busca por nome
if (isset($_GET['HTML_nome_EMPRESA'])) {

    $busca = $_GET['HTML_nome_EMPRESA'];
    $rsEmpresas = $objBDEmpresas->listaEmpresas(2, $busca);
}
// busca por regiao
if (isset($_GET['reg'])) {

    $codReg = $_GET['reg'];
    $rsEmpresas = $objBDEmpresas->listaEmpresas(3, $codReg);
}
?>
<table align="center" width="60%">
    <tr>
        <?php
        //enquanto houver empresas no rsEmpresas
        while ($tblEmpresas = mysql_fetch_array($rsEmpresas)) {
            ?>       
            <td align="center">
                <a href="index.php?codPg=110&codEmp=<?= $tblEmpresas['codigo_EMPRESA'] ?>">
                    <img src="_images/_system/<?= $tblEmpresas['logo_EMPRESA'] ?>" width="150" height="100"><br>
                    <?= $tblEmpresas['nome_EMPRESA'] ?>
                </a>
            </td>            
            <?php
        }
        ?>
    </tr>
</table>

///////////////////////////////////////////////////

    </div>

    <div id="DivMenu">
        <?php
            include "MenuHome.php";                
        ?>
        <hr>
    </div>

    <div id="DivConteudo">
        <?php
            //mapeamento de links

            if(!isset($_GET['codPg']) || $_GET['codPg'] == 0){
                include "ListaEmpresas.php";
                //include "ListaServicos.php;
                //include "ListaParceiros.php;
            }else{
                 if($_GET['codPg'] == 100)
                    include "BuscaEmpresa.php";
                if($_GET['codPg'] == 110)
                    include "PerfilEmpresa.php";                   
                if($_GET['codPg'] == 120)
                    include "FormEmpresas.php";                   
                if($_GET['codPg'] == 130)
                    include "FormServicos.php";                   

            }
        ?>

    </div>     

</body>

I would like to understand why the images do not appear.

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • Can show the SQL and the database structure ?

  • Press F12 in your browser and go to the network tab, possibly the image URL is wrong, if any, it will appear in red in the file listing.

  • @Augusto Updated the post with the images.

  • @Jeffersonsalvador Yes appears in red (as print on post) and gives error 404 not found ,but strange because the image’s path is: C: phpcic Empresas_images_system *this is also the path Alias and the name and phpcic (I use easyphp)

  • @Wesleysouza, if you notice the error in red you will see that you have fragments of PHP, it should be converted already. Try to replace "<?=" with "<?? php echo" in your code, I think the "short_open_tag" is not active in your installation

  • @Jeffersonsalvador, I had already changed the short to: ; short_open_tag ; Default Value: On ; Development Value: On ; Production Value: On but realizing the change(I’m even doing it in other classes too) that you proposed the images appeared , Thank you very much!

  • Print the source code of after it appears in the browser

  • @Jeffersonsalvador Feito!

  • It is the source code generated by the browser, after processing PHP @Wesleysouza

  • @Jeffersonsalvador Esse?

  • That’s right @Wesleysouza. If you take the image url and paste in the browser’s address bar the image appears?

  • Yes @Jeffersonsalvador Perfectly ! , now I will put validations in the fields of registration , improve the layout ,Thank you again

  • The error is still the initial you posted or now simply the images do not appear?

  • After your <?= replacement hint for <?php echo , all images appeared normally!

Show 9 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.