Jump to content

[Resolvido] agenda


legd1991

Recommended Posts

Boas pessoal

estou a fazer uma agenda electronic em php. estou com um problema:

tenho o seguinte pedaço  de codigo na pagina admin:

case "A":
					$sql = "select * From agenda";
					$result = mysql_query($sql,$con);
					$nRegistos = mysql_num_rows($result);
					if($nRegistos!=0){
						echo " <table width=\"600\" border=\"0\" align=\"center\">";
						for($i=1;$i<=$nRegistos;$i++){
							$registo = mysql_fetch_array($result);
							echo "<tr align=\"center\" valign=\"middle\">";
    								echo "<td> <a href =\"actualiza.php?id={$registo['ID']}\">{$registo['nome']}</a></td>";
							 	echo "</tr>";
						}
							echo "</table>";	
					}else { echo"<p> Nao existem registos:".$nRegistos. "</p>";}
					break;

depois tenho no actualiza assim:

<?php
session_start();

require_once("includes/connection.php");
$user=$_GET['id'];
$sql = "select * from agenda where ID=".$user;
$res = mysql_query($sql,$con);
$registo = mysql_fetch_array($res);
$_SESSION['id'] = $registo['ID'];

?>

no codigo sql queria q seleccionasse o registo que foi sescolhido na pagina admin, ou seja queria transportar o id para o actualiza dependendo do registo que escolhesse

cumps

legd1991

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.