Show image of Bank Mysql with 2ids different but common field in PHP

0

I have a page cadastro_cartao.php

In this page I have INPUTS to enter Name, CPF, Phone Contact, plus an INPUT type File for the person to put photo of the documents and photo of proof of residence.

When you click Send, it inserts the information into the Database but generates an Id for each image the person entered, ie

If CPF 111.111.111-85 entered the Name, CPF, Telephone and 2 Images in the BD  Mysql inserted it this way:

ID: 1 / Photo: Photo1 / Name: ALEX / CPF: 111.111.111-85 / Telephone: xx xxxxxxxxx

ID: 2 / Photo: Foto2 / Name: ALEX / CPF: 111.111.111-85 / Telephone: xx xxxxxxxxx

You are inserting correctly into DB

I have another page that does Analysis of Sent Documents called analise_cartao.php

Where under a query in the bank brings the data grouped by CPF

In other words, in the presentation on the page the images are not shown, but it shows the data grouped by CPF and stays this way

Name: ALEX / CPF: 111.111.111-85 / Telephone: xx xxxxxxxxx

On this page analise_cartao.php I have a link <a href='ver-cad-cartao.php?cpf=$res_sql[cpf]' title='Ver'><img src='imagem/bg-view.fw.png'></a> where I pass by parameter in the link the cpf to see the complete cadastre:

My question is: How to make the page ver-cad-card.php load the linked images in this cpf, since in the code I made it only displays the image of id 1, not the two id1 and id2 I want.

Code page ver-cad-card.php

<?php
require_once("../funcoes/conexao.php"); 
$cpf = $_GET['cpf'];

$sql = mysql_query("SELECT * FROM faca_cartao where cpf='$cpf'") or die (mysql_error());  
$res_sql = mysql_fetch_array($sql);{
echo '  
<div>       
<img  src="../cartao/'.$res_sql["document_name"].'" width="300px">
</div>  ';
}
?>
    
asked by anonymous 24.08.2018 / 19:43

1 answer

0
Você pode fazer assim
$sql = mysql_query("SELECT * FROM faca_cartao where cpf='$cpf'") or die (mysql_error());  

$rowsfound = mysql_num_rows($sql);
if($rowsfound > 0)
{
  $count = 0;
  while($row = mysql_fetch_array($result))
{
echo '  
<div>       
  <img  src="../cartao/'.$row[$count]["document_name"].'" width="300px">
</div>  ';
$count++;
}
}
    
24.08.2018 / 19:47