Jump to content
Sign in to follow this  
RedCandy

SQL retorna nada da base de dados

Recommended Posts

RedCandy

Bom dia, eu quero que no seguinte código o SQL retorna da base de dados os valores "id_Admin", "username_Admin", "password_Admin", mas não retorna nada apesar de não dar quaisquer erros.

<?php 
	
		$servername = "localhost";
		$username = "root";
		$password = "";
		$db = "aeac";

		// Create connection
		$conn = mysqli_connect($servername, $username, $password, $db);
		
		// Check connection
		if(mysqli_connect_errno()){
			die("connection failed: "
				. mysqli_connect_error()
				. " (" . mysqli_connect_errno()
				. ")");
		}
		
		//get results from database
		$result = mysqli_query($conn, "SELECT * FROM admin");
		
		echo "<table id='tableId' align='center' style='width:60%; height:5%'>
		<tr>
		<th>ID</th>
		<th>Nome</th>
		<th>Password</th>
		</tr>";
	
		while ($property = mysqli_fetch_array($result));
		{
			echo "<tr>";
			echo "<td onclick='redirect()'>" . $property['id_Admin'] . "</td>";
			echo "<td onclick='redirect()'>" . $property['username_Admin'] . "</td>";
			echo "<td onclick='redirect()'>" . $property['password_Admin'] . "</td>";
			echo "</tr>";
					
		}
		echo "</table>";
		
	?>

Já fiz várias pesquisas e troquei várias vezes o código para ver se algo funcionava mas nada. Tenho a certeza que todos os campos estão iguais aos da base de dados.

Desde já obrigado, RedCandy.

Share this post


Link to post
Share on other sites
RedCandy
15 horas atrás, HappyHippyHippo disse:

mysql_fetch_assoc? 

não resultou.

Share this post


Link to post
Share on other sites
HappyHippyHippo

Não resultou é uma resposta sem qualquer conteúdo informativo


IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

×
×
  • 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.