duda php

chanquete
<html>
	<body>
		<center>
		<?php
		$con = mysql_connect("localhost","juan","juan");
		if (!$con)
		  {
		  die('Could not connect: ' . mysql_error());
		  }

	mysql_select_db("futbol", $con);

	$result = mysql_query("SELECT * FROM liga");
	echo "LISTADO DE CLUBES <br/>";
		while($row = mysql_fetch_array($result))
	  {
	  echo $row['equipos'] . " " . $row['socios']." ".$row['ciudad'];
	  echo "<br />";
	  }

	mysql_close($con);
	?>
</center>
	</body>
</html>

Este es el código de una base de datos. Me funciona perfectamente. Pero quiero que me meta los resultados en una tabla. es decir equipos | socios |ciudad he intentado meter una tabla dónde el while y no me funciona. Algo estoy haciendo mal.

chanquete

Solucionado

<html>
	<body>
		<center>
		<?php
		$con = mysql_connect("localhost","juan","juan");
		if (!$con)
		  {
		  die('Could not connect: ' . mysql_error());
		  }

	mysql_select_db("futbol", $con);

	$result = mysql_query("SELECT * FROM liga");
	echo "LISTADO DE CLUBES <br/>";
		echo "<table border='1'>";while($row = mysql_fetch_array($result))
	  {
	  echo "<tr><td>". $row['equipos'] . "</td><td> " . $row['socios']."</td><td> ".$row['ciudad']."</td></tr>";
	  }echo "</table>";

	mysql_close($con);
	?>
</center>
	</body>
</html>

Usuarios habituales

  • chanquete