Jump to content

Recommended Posts

<?PHP
$conn = mysql_connect("localhost", "root", "") or die("Impossivel conectar");

if($conn)
	{
		mysql_select_db("eventos", $conn);	
		} 
		$sql = "SELECT * from eventos where id_eventos=1";		
		$rs = mysql_query($sql, $conn);		
		$num = mysql_num_rows($rs);
		if($num > 0)
		{
			echo "<table border=0 cellpadding=0 cellspacing=0>\n";
			echo "<table border=0 cellpadding=3 cellspacing=0>
			<tr>
			<td>Nº de Evento</td>
			<td>Nome</td>
			<td>Descrição</td>
			<td>Requisitos</td>
			<td>Data</td>
			<td>Vencedor</td>
			</tr>";
			while($dados = mysql_fetch_array($rs))
			{
				$id 	= $dados["id_eventos"];
				$nome 	= $dados["nome"];
				$desc    = $dados["descricao"];
				$req   = $dados["requisitos"];
				$data = $dados["data"];
				$vence   = $dados["vencedor"];
				//$img = $dados["imagens"];
				echo"		<tr>";
				echo"		<td>$id</td>";
				echo"		<td>$nome</td>";
				echo"		<td>$desc</td>";
				echo"		<td>$req</td>";
				echo"		<td>$data</td>";
				echo"		<td>$vence</td>";
				echo "<td>";
				echo"<a href=\"1.php?id=$id\/a>";
				
				echo"</td>";		
				echo"	</tr>\n";
			}
	   	}
    echo "</table>\n";
?>

 

tenho este codigo, e lista todos os dados que tenho, e cada 1 tem 1 link, mas o link é igual para todos..

como faço para que em cada click, abra o registo correspondente?

 

algum select pelo id ou qualquer coisa?

 

ps: quando veem o select do id_eventos = 1 foi só para testar.. se dava erro até lá..  estes eu tinha lá "$id"

Edited by jopereira
        if($num > 0)
        {
            echo "<table border=0 cellpadding=0 cellspacing=0>\n";
            echo "<table border=0 cellpadding=3 cellspacing=0>
            . . .
        }
echo "</table>";

 

2 open table tags and one close table tag that is not echoed under the same conditions as table open

Edited by Barand

sorry.. i forgot this was an inglish site..

 

my question is about the links of the listed "items"

 

I've got 3 listed items, like this:

 

Item one

 

Item two

 

Item three

 

each one of this items have a link, but all the 3 items are different rows from the same table, but all the links open the same

 

how can I distinct each one of the links?

I got the code above, that is included in the index page, as you can see here:

 

...			
                                <div id="column2">
				<h2>Artigos</h2>
				<ul class="list-style2">
				
				<?php include "listar_evento.php" ?>
				</ul>
				<p><a href="#" class="link-style">Read More</a></p>
			</div>
			<div id="column3">
				<h2>Em Destaque</h2>
				<p><img src="images/evento1.jpg" width="430" height="200" alt="" /></p>
				<p>Detalhes do evento publicados em breve.</p>
				<p><a href="#" class="link-style">Read More</a></p>
			</div>
			
		</div>
	</div>
	
</div>
</body>
</html>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.