Ir para conteúdo
Fórum Script Brasil

ruam

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre ruam

ruam's Achievements

0

Reputação

  1. //esse arquivo é o listarnota.php <?php //include("verificarsessao.php"); include("conexao.php"); $sql = mysql_query("select * from nota order by id"); //fechando o if do acao=excluir ?> <html><head> <title> Listagem de Cargas </title> </head> <body bgcolor="#EFEFEF"> <table width="80%" align="center" border="9"> <tr> <td align="center">Nota</td> <td align="center">Data-Hora</td> <td align="center">Transportador</td> <td align="center">Lacre</td> <td align="center">Saida</td> <td align="center">Alterar</td> </tr> <?php while($result = mysql_fetch_array($sql)) { //enquanto tiver dados sendo retornados da consulta //sql, a variável result estará sendo preenchida e //automaticamente será criada uma nova linha tr ?> <tr> <td align="center"><?php echo $result['nota'];?></td> <td align=center"><?php echo $result['data];?></td> <td align="center"><?php echo $result['transportador'];?></td> <td align=center"><?php echo $result['lacre];?></td> <td align="center"><?php echo $result['saida'];?></td> <td align=center"><a href="alterarnota.php?id=<?php echo $result['id];?>"> <img src="imagem/editar.png" border="0" title="Click p/Editar"/></a></td> <?php /* Tudo que vem depois do .php chama-se parametro de links. O 1º parametro obrigatoriamente tem que ser com ?, do segundo em diante usa-se o & Exemplo: arquivo.php?valor=203&valor2=123&valor3=99 e assim em diante */ ?> </a> </td> </tr> <?php } //fechando o while ?> </table> </body> </html> ---------------------------------------------------------------------------- //esse arquivo é o alterarnota.php <?php @$yago=$_GET['yago']; include "conexao.php"; @$result= mysql_query("select * from nota where id=’$yago’"); echo "<form name=form' action='update.php' method='post'>"; while(@$row= mysql_fetch_array($result)){ echo "<input type='text' name='yago' value='.$row'id'.'><br>"; echo "<input type='text' name='nota' value='.$row'nota'.'><br>"; echo "<input type='text' name='transportador' value='.$row'transportador'.'><br>"; echo "<input type='text' name='lacre' value='.$row'lacre'.'><br>"; echo "<input type='text' name='saida' value='.$row'saida'.'><br>"; echo "<input type='submit' value='Salvar'>"; echo "<input type='button' value='Voltar' onclick=\”location.href=’listar.php’\” >"; } ?> ------------------------------------------------ // esse arquivo e o update.php <?php @$id=$_POST['yago]; @$nota = $_POST['nota']; @$transportador = $_POST['transportador']; @$lacre = $_POST['lacre']; @$saida = $_POST['saida']; include "conexao.php"; @$result= mysql_query("UPDATE nota SET nota = ‘$nota’,transportador = ‘$transportador’, lacre = ‘$lacre’, saida = ‘$saida’ WHERE id=’$yago’"); @mysql_close(!$con); echo "<input type='button' value='Voltar' onclick='location.href='listarnota.php'' >"; ?> ========================================================== banco create database nota( id int not null auto_incremente primary key, nota varchar (30), transportador varchar (30), lacre varchar (30), saida varchar (30) );
×
×
  • Criar Novo...