0

Hi,

i'm working on a website where i in the backoffice i can choose what table the frontoffice will see.

The objective is create a checkbox in the backoffice and if checked (prod_img="yes") the frontoffice sees the table with big_images (prod_img) if the checkbox is not checked (prod_img="no") the front office sees the regular table with reference and descriptioN...

But before i work with the backoffice i'm doing the code to see if the prod_img is "yes" or "no" can you help me?

    <?php require_once('Connections/futura.php'); ?>

    <?php
        set_time_limit(0);
        include("incluir.php");


        $query_categorias = "SELECT * FROM materiais ORDER BY ordem ASC";
        $categorias = mysql_query($query_categorias, $futura) or die(mysql_error());
        $row_categorias = mysql_fetch_assoc($categorias);
        $totalRows_categorias = mysql_num_rows($categorias);


        $query_cores = "SELECT * FROM janelas WHERE id_categoria='2'";
        $cores = mysql_query($query_cores, $futura) or die(mysql_error());
        $row_cores = mysql_fetch_assoc($cores);
        $totalRows_cores = mysql_num_rows($cores);


        $query_categ_list = "SELECT * FROM materiais ORDER BY ordem ASC";
        $categ_list = mysql_query($query_categ_list, $futura) or die(mysql_error());
        $row_categ_list = mysql_fetch_assoc($categ_list);
        $totalRows_categ_list = mysql_num_rows($categ_list);
    ?>
    <!------------------------------------------------------------------------------>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="shortcut icon" type="image/x-icon" href="imagens/plasticos.ico" />
        <link href="styles/style.css" rel="stylesheet" />
        <title>Plásticos Futura - Produtos</title>
        <script type="text/javascript" src="js/java.js"></script>
        <script type='text/javascript' src='jquery/jquery.js'></script>
    </head>
    <!------------------------------------------------------------------------------>
    <body>
        <table width="1200" border="0" align="center" cellpadding="0" cellspacing="0" style="background-image:url(imagens/fundo7.jpg);background-repeat:repeat-y;">
            <tr>
                <td>
                    <table width="1200" border="0" align="center" cellpadding="0" cellspacing="0" style="background-image:url(imagens/fundo6.jpg); background-repeat:no-repeat;" height="713" >
                        <tr>
                            <td height="60" valign="bottom"><?php include("topo.php"); ?></td>
                        </tr>

                        <tr>
                            <td height="613" valign="top">
                                <table width="1200" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td valign="top">
                                            <table width="260" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td align="right"><a href="index.php" title="Voltar à homepage"><img src="imagens/plasticos-futura.png" border="0" /></a></td>
                                                </tr>

                                                <tr>
                                                    <td height="40"></td>
                                                </tr>

                                                <tr>
                                                    <td>
                                                        <table width="250" border="0" align="right" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="30"></td>
                                                                <td height="26" class="menu" onclick="window.location='index.php'"><a href="index.php" class="menu_text" title="Home - Plásticos Futura">Home</a></td>
                                                            </tr>

                                                            <tr>
                                                                <td height="2"></td>
                                                                <td height="2"></td>
                                                            </tr>

                                                            <tr>
                                                                <td width="30"></td>
                                                                <td height="26" class="menu" onclick="window.location='empresa.php'"><a href="empresa.php" class="menu_text" title="Empresa - Plásticos Futura">Empresa</a></td>
                                                            </tr>

                                                            <tr>
                                                                <td height="2"></td>
                                                                <td height="2"></td>
                                                            </tr>

                                                            <tr>
                                                                <td width="30"></td>
                                                                <td height="26" class="menu" onclick="window.location='produtos.php'"><a href="produtos.php" title="Produtos - Plásticos Futura" class="menu_text"><strong>Produtos</strong></a></td>
                                                            </tr>

                                                            <tr>
                                                                <td height="2"></td>
                                                                <td height="2"></td>
                                                            </tr>

                                                            <?php do { ?>
                                                                <tr>
                                                                    <td width="30" height="18"></td>
                                                                    <td height="20" class="submenu2" onclick="window.location='#cat<?php echo $row_categorias['id_material']; ?>'"><a href="#cat<?php echo $row_categorias['id_material']; ?>" class="submenu_text"><?php echo $row_categorias['material']; ?></a></td>
                                                                </tr>

                                                                <tr>
                                                                    <td height="3"></td>
                                                                    <td height="3"></td>
                                                                </tr>
                                                            <?php } while ($row_categorias = mysql_fetch_assoc($categorias)); ?>


                                                            <tr>
                                                              <td height="2"></td>
                                                              <td height="2"></td>
                                                            </tr>

                                                            <tr>
                                                                <td width="30"></td>
                                                                <td height="26" class="menu" onclick="window.location='noticias.php'"><a href="noticias.php" class="menu_text"  title="Notícias - Plásticos Futura">Notícias</a></td>
                                                            </tr>

                                                            <tr>
                                                                <td height="2"></td>
                                                                <td height="2"></td>
                                                            </tr>

                                                            <tr>
                                                                <td width="30"></td>
                                                                <td height="26" class="menu" onclick="window.location='oportunidades-de-negocio.php'"><a href="oportunidades-de-negocio.php" class="menu_text"  title="Oportunidades de Negócio - Plásticos Futura">Oportun. Negócio</a></td>
                                                            </tr>

                                                            <tr>
                                                                <td height="2"></td>
                                                                <td height="2"></td>
                                                            </tr>

                                                            <tr>
                                                              <td width="30"></td>
                                                              <td height="26" class="menu" onclick="window.location='recrutamento.php'"><a href="recrutamento.php" class="menu_text"  title="Recrutamento - Plásticos Futura">Recrutamento</a></td>
                                                            </tr>

                                                            <tr>
                                                              <td height="2"></td>
                                                              <td height="2"></td>
                                                            </tr>

                                                            <tr>
                                                                <td width="30"></td>
                                                                <td height="26" class="menu" onclick="window.location='contactos.php'"><a href="contactos.php" class="menu_text"  title="Contactos - Plásticos Futura">Contactos</a></td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>

                                        <!----------------------------------------------------------------------------------------------------->
                                        <!--BIG IMAGE-->
                                        <td>
                                            <?PHP
                                            do{
                                                $query_produtos = "SELECT * FROM produtos WHERE id_material='".$row_categ_list['id_material']."' ORDER BY referencia ASC";
                                                $produtos = mysql_query($query_produtos, $futura) or die(mysql_error());
                                                $row_produtos = mysql_fetch_assoc($produtos);
                                                $totalRows_produtos = mysql_num_rows($produtos);

                                                $query_verimg = "SELECT * FROM produtos_img WHERE id_produto='".$row_produtos['id_produto']."' ORDER BY default_ DESC";
                                                $verimg = mysql_query($query_verimg, $futura) or die(mysql_error());
                                                $row_verimg = mysql_fetch_assoc($verimg);

                                                $query_imgbig="SELECT * FROM produtos WHERE id_produto = ".$row_prdutos['id_produto'];
                                                $big_img = mysql_query($query_imgbig, $futura);

                                                if ($big_img['prod_img']="sim")
                                                {


                                            ?>
                                                            <table width="570" border="0" cellspacing="0" cellpadding="0">
                                                                <tr>
                                                                    <td width="160" height="95" valign="top">
                                                                        <a href="ver_produto.php?id_produto=<?php echo $row_produtos['id_produto']; ?>&id_categoria=<?php echo $row_produtos['id_material']; ?>"><?php if($row_verimg['imagem']!="") { ?><img src="http://www.plasticos-futura.com/timthumb.php?src=http://www.plasticos-futura.com/produtos/<?php echo $row_verimg['imagem']; ?>&w=134px&h=98px&zc=1&q=100" width="134" height="98" style="border:1px solid #cccccc;" /><?php } else { ?><img src="imagens/futura.jpg" width="400" height="350" style="border:1px solid #cccccc;" /><?php } ?></a>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                <?PHP
                                                ;}
                                                else
                                                {
                                                ?>
                                                <!--TABLE WITH INFO (DESCRIPTION | REFERENCE)-->
                                                            <td width="631" valign="top" class="texto_pretobig2" style="padding-bottom:10px;"><div class="bomfundo" style="background-color:<?php echo $row_cores['cor']; ?>;">
                                                                <table width="570" border="0" cellspacing="0" cellpadding="0">
                                                                <?php do {  ?>
                                                                    <tr>
                                                                        <td colspan="2" class="div_topo"><a name="cat<?php echo $row_categ_list['id_material']; ?>"></a>  <strong>PRODUTOS :: <span class="texto2"><?php echo $row_categ_list['material_en']; ?></span></strong></td>
                                                                    </tr>

                                                                    <tr>
                                                                        <td colspan="2" height="16"></td>
                                                                    </tr>                                                        

                                                                    <tr>
                                                                        <td width="160" height="95" valign="top">
                                                                            <a href="ver_produto.php?id_produto=<?php echo $row_produtos['id_produto']; ?>&id_categoria=<?php echo $row_produtos['id_material']; ?>"><?php if($row_verimg['imagem']!="") { ?><img src="http://www.plasticos-futura.com/timthumb.php?src=http://www.plasticos-futura.com/produtos/<?php echo $row_verimg['imagem']; ?>&w=134px&h=98px&zc=1&q=100" width="134" height="98" style="border:1px solid #cccccc;" /><?php } else { ?><img src="imagens/futura.jpg" width="134" height="98" style="border:1px solid #cccccc;" /><?php } ?></a>
                                                                        </td>

                                                                        <td valign="top" class="texto_pretobig2"><strong>REFERÊNCIA: </strong><?php echo $row_produtos['referencia']; ?><br />
                                                                            <strong>DESCRIÇÃO:</strong> <?php echo $row_produtos['nome']; ?>
                                                                            <br/>
                                                                            <br/>

                                                                            <div id="a_img">
                                                                                <a href="ver_produto.php?id_produto=<?php echo $row_produtos['id_produto']; ?>&id_categoria=<?php echo $row_produtos['id_material']; ?>" class="a_img">Mais imagens</a>
                                                                            </div>
                                                                        </td>    
                                                                    </tr>

                                                                    <tr>
                                                                        <td width="160" height="10" style="border-bottom:1px dashed #e0e0e0;"> </td>
                                                                        <td height="10" style="border-bottom:1px dashed #e0e0e0;"> </td>
                                                                    </tr>

                                                                    <tr>
                                                                        <td width="160" height="10"></td>
                                                                        <td height="10"></td>
                                                                    </tr>

                                                                    <?php } while ($row_produtos = mysql_fetch_assoc($produtos)); ?>
                                                                    <tr>
                                                                        <td width="160" height="30"></td>
                                                                        <td height="10" align="right"><a href="#topo" style="text-decoration:none;"><img src="imagens/arrow.gif" border="0" align="absmiddle" /> Topo da página</a> </td>
                                                                    </tr>
                                                                    <?php ;} while ($row_categ_list = mysql_fetch_assoc($categ_list)); ?>
                                                                </table>
                                                            </td>
                                        </td>
                                    <!----------------------------------------------------------------------------------------------------->
                                        <td width="178"></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>

                        <tr>
                            <td height="46" style="background-image:url(imagens/fundo4.jpg); background-repeat:no-repeat"><?php include("rodape.php"); ?></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </body>
    </html>
2
Contributors
1
Reply
7
Views
5 Years
Discussion Span
Last Post by LastMitch
0

The objective is create a checkbox in the backoffice and if checked (prod_img="yes") the frontoffice sees the table with big_images (prod_img) if the checkbox is not checked (prod_img="no") the front office sees the regular table with reference and descriptioN...

I don't know whether you are connected to the database or your query works either.

On line 169 This is looks wrong to me ( there should be an extra equal sign ):

if ($big_img['prod_img']="sim")

it should be

if($big_img['prod_img']=="sim"){

You code is a bit messy here:

if($big_img['prod_img']=="sim"){

<a href="ver_produto.php?id_produto=<?php echo $row_produtos['id_produto']; ?>&id_categoria=<?php echo $row_produtos['id_material']; ?>">

<?php if($row_verimg['imagem']!="") { ?>

<img src="path/timthumb.php?src=path/<?php echo $row_verimg['imagem']; ?>&w=134px&h=98px&zc=1&q=100" width="134" height="98" style="border:1px solid #cccccc;" />

<?php } else { ?>

<img src="imagens/futura.jpg" width="400" height="350" style="border:1px solid #cccccc;" />

<?php } ?></a>

I got no idea what you are trying to do.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.