How to make list of details of a specific product

Asked

Viewed 175 times

0

there is an area on my system where the user sees a list of products, by clicking on the product he can see the details of it. My doubt is how to do this page of details. How am I going to get the specific code of a product so that the system knows that it is this product that has to search in the bank its details?

tried to do this way (not finding the pag):

Mprojetos.php

<?php
$usuario=$_SESSION['email'];

 require_once 'Classes/ProjetosVO.php';
require_once 'Classes/ProjetosDAO.php';


 $objBDProjeto=new ProjetosDAO();
$objProjeto= new ProjetosVO();

 $rsProjeto= $objBDProjeto->ListarProjetos("1");
 $tblProjeto= mysqli_fetch_array($rsProjeto);

 $mysqli = new mysqli('localhost', 'root', '', 'bdpi');


  ?>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
  <script src="https://use.fontawesome.com/eb2dfeaa2c.js"></script>
 <br>
 <br>
 <center><h1 class="Titulo">Meus Projetos</h1></center>
 <center>
 <br>
  &nbsp;&nbsp;
<?php
include 'FormCadastraProjeto.php';
?>
  <?php
while($tblProjeto= mysqli_fetch_array($rsProjeto)){

 $query = "select cor_PROJETO from usuarios U, projetos P where email_USUARIO like '$usuario' and U.email_USUARIO=P.responsavel_PROJETO";
 $resource= mysqli_query($mysqli,$query) or die(mysqli_error($mysqli));
 $resultado = mysqli_fetch_array($resource);
 $cor = $resultado['cor_PROJETO'];
    ?>
  <a href="Projeto.php&codProjeto=<?=$tblProjeto['codigo_PROJETO'];?>" style="color: <?php echo $cor; ?>"><h1><i class="fa fa-folder" aria-hidden="true"></i></h1>

    <?php
    $projeto=$tblProjeto['nome_PROJETO'];
    echo $projeto;

    ?>
  </a>

    <?php
               }
               ?>

Project.php (where a href should lead)

<?php

$usuario=$_SESSION['email'];

 require_once 'Classes/ProjetosVO.php';
 require_once 'Classes/ProjetosDAO.php';
 require_once "Classes/BancoDAO.php";

 $objBDpi = new BancoDAO(); 
 $objBDpi->AbreConexao();

 $mysqli = new mysqli('localhost', 'root', '', 'bdpi');

 $codProjeto=$_GET['codProjeto'];

 $sqlDetalhes= "Select * from projetos where codigo_PROJETO='$codProjeto'";//montando select

  $rsDetalhes= mysqli_query($mysqli,$sqlDetalhes) or die (mysqli_error($mysqli));//
  $tblDetalhes= mysqli_fetch_array($rsDetalhes);


?>

oi

1 answer

1

The question’s pretty vague, but come on. I believe that these products are in a database, you need to read the database and write these descriptions somewhere in the HTML. For example in the header of the page vc does this after connecting to the database

$proc_descricao = mysql_query("select * from produtos where id='".$id_produto."'");
$pega_procutos = mysql_fetch_array($proc_descricao);

Inside a div for example

<div>
 Nome_Produto - <? echo $pega_procutos['nome']; ?>
 Peso_Produto - <? echo $pega_procutos['peso']; ?>
</div>
  • It would be simpler to use <?=$pega_procutos['nome']; ?>, minus code, same effect.

  • The question did not have this lot of codes at the time I answered. kkk

  • Fix the link <a href="Projeto.php?codProjeto=<?=$tblProjeto['codigo_PROJETO'];?> >.

  • Obrigadoo kkkkkk

Browser other questions tagged

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