Database does not show the information

Asked

Viewed 727 times

0

Well I created a database on PhpMyAdmin by name students a table called information and put the data in it...

Then I went to add it to my website when I add the code instead of the table information...

Follow my code below:

< ?php
$tabela = msql_query("SELECT * FROM `informacoes`") ;
    while($resultado = mysql_fetch_array($tabela)){

    }

    $host = "localhost";
    $bd = "alunos";
    $user = "root";
    $senha = "";

    $conexao = mysql_connect ($host, $user, $senha) or die (mysq_error());
    mysql_select_db($bd, $conexao);

    echo"informacoes $alunoid<br />$nome<br />$email<br />$turno<br />$UF<br />";

? >

1 answer

0


Make the connection first and then the search, try it like this:

< ?php

$host = "localhost";
$bd = "alunos";
$user = "root";
$senha = "";

$conexao = mysql_connect ($host, $user, $senha) or die (mysq_error());
mysql_select_db($bd, $conexao);

$tabela = msql_query("SELECT * FROM informacoes") ;
    while($resultado = mysql_fetch_array($tabela)){
       echo "Informações: " . $resultado['idaluno'] . "<br/>" . resultado['nomealuno'] ."<br/>". resultado['email'] . "<br/>". resultado['turno'] . "<br/>" . resultado['uf'] . "<br/>";      
    }

? >

Browser other questions tagged

You are not signed in. Login or sign up in order to post.