Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Listing items with different links

$
0
0

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 this code:

<?PHP
//echo "<link href='default.css' rel='stylesheet' type='text/css' media='all' />";
$conn = mysql_connect("localhost", "root", "") or die("Impossivel conectar");

if($conn)
	{
		mysql_select_db("eventos", $conn);	
		} 
		$sql = "SELECT id_eventos, nome FROM eventos";		
		$rs = mysql_query($sql, $conn);		
		$num = mysql_num_rows($rs);
		if($num > 0)
		{
			//echo "<table border=0 cellpadding=0 cellspacing=0>\n";

			while($dados = mysql_fetch_array($rs))
			{
				$ref 	= $dados["id_eventos"];
				$nome 	= $dados["nome"];
			/*	$img = $dados["imagens"];
				echo"		<tr>";
				echo"		<td>$ref</td>";
				echo"		<td>$desc</td>";
				echo"		<td>$pvp</td>";
				echo"		<td>$func</td>";
				echo"		<td>$garant</td>";*/
			//	echo "<td>";
			
				//echo "<li><a href=\"mostra_evento.php?id=$ref\"></li>";
				echo"<li><a href=\"listar_imagem.php?id=$ref\">$nome</a></li>";
				//echo"</td>";		
				//echo"	</tr>\n";
			}
	   	}
   // echo "</table>\n";
?>
<?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))
			{
				$ref 	= $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>$ref</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=\"listar_imagem.php?id=$id\"></a>";
				
				echo"</td>";		
				echo"	</tr>\n";
			}
	   	}
		echo "</table>";
    echo "</table>\n";
?>

can you help?


Viewing all articles
Browse latest Browse all 13200

Trending Articles