1
Hello I’m with this code and I’m trying to make an adaptation to use it, but I’m having trouble bringing the contents of the column edit quant_img table, but I’m not sure how. Friends could shed some light on how I can do!!!!
Below I relate the code:
<?php
include 'cabecalho.php';
?>
<?php
include '../conexao.php';
$editar = $_POST['editar'];
$query = mysql_query("SELECT * FROM quant_img");
$res = mysql_fetch_array($query);
?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<div align="center" style="margin: 0 0 0 180px; max-width:1000px; width: 90%;">
<div align="left" style="margin:0 0 0 10px;"><h3>Atualização de Produtos</h3></div>
<div align="center" style=" padding:2px; width:655px; height:auto; float:left;">
<div align="left" style=" padding:2px; width:315px; height:auto; float:left;">
<label>Entre com o código do produto</label>
<form action="prod_consulta.php" enctype="multipart/form-data" name="busca" method="post">
<input size="6" type="text" value="" name="buscar"/>
<input type="submit" name="busca" value="Buscar Produto"/>
</form>
</div>
</div>
<div align="left" style=" padding:2px; width:1000px; height:auto; border-top:solid 2px; float:left;">
<br />
<?php
$buscar = $_POST['buscar'];
$sql_listar = mysql_query("SELECT * FROM produto WHERE codigo LIKE '%$buscar%'");
$total_registros = mysql_num_rows($sql_listar);
if(mysql_num_rows($sql_listar) <= 0){
echo '<script type="text/javascript">
alert("Desculpe! Nenhum produto foi encontrado com esse código!");
window.location.href = "prod_upd.php";
</script>';
}else{
while($res = mysql_fetch_array($sql_listar)){
$codigo = $res['codigo'];
$codigo = $_POST['codigo'];
$titulo = $_POST['titulo'];
$descricao = $_POST['descricao'];
$preco = $_POST['preco'];
$codcategoria = $_POST['codcategoria'];
$codmarca = $_POST['codmarca'];
$img01 = $_POST['img01'];
$conteudotabela .= '<tr style="color:#090;">
<td align="center">'.$res['codigo'].'</td>
<td align="center">'.$res['titulo'].'</td>
<td align="center">'.$res['preco'].'</td>
<td align="center">
<img width="100" height="auto" src="../img_produtos/'.$res['img01'].'" /></td>
<td align="center">
<a style="text-decoration:none;" href="'.$res['editar'].'?codigo='.$res['codigo'].'">
<img width="25" src="../img/edit.png" title="Editar Produto código '.$res['codigo'].'"/>
</a>
<a style="text-decoration:none;" href="prod_del.php?codigo='.$res['codigo'].'">
<img width="25" src="../img/del.png" title="Excluir Produto código '.$res['codigo'].'"/>
</a>
</td>
</tr>';
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<table class="tbllista" style="width: 15%">
<thead>
<tr align="center">
<th style="width: 5%"></th>
<th style="width: 5%">
</tr>
</thead>
</table>
<table class="tbllista" style="width: 100%">
<thead>
<tr align="center">
<th align="center">Código</th>
<th align="center">Título</th>
<th align="center">Preço</th>
<th align="center">Imagem</th>
<th align="center">Operações</th>
</tr>
</thead>
<tbody>
<?php echo $conteudotabela; ?>
</tbody>
<?php
}
?>
</div>
Thank you for the attention of friends.
Sometimes less is more. This whole code only gets in the way, it’s hard to understand what you want to do. Exactly where is the problem?
– Papa Charlie