Joao Batista
New member
So I am doing a report on school which the objective is creating a database on localhost (a table with names, etc..). I made an HTML to insert values to my database, and that works! The problem is it can´t show the MYSQL table on .php
For some reason it´s blank. It shows nothing except the hyperlinks for the rest of the page. Can someone tell me what is wrong?
<?php
$nome=$_POST['nome'];
$telefone=$_POST['telefone'];
$bi=$_POST['bi'];
echo "<a href=http://localhost/grupoN12-19/12-19.html>Inserir Registo</a>"; echo("<br>");
echo "<a href=http://localhost/grupoN12-19/12-19-update.php>Actualizar um registo</a>"; echo("<br>");
echo "<a href=http://localhost/grupoN12-19/12-19-delete.php>Apagar um registo</a>";
$ligacao=mysql_pconnect("localhost", "root","");
$bd="n12-n19";
$query="insert into teste2(Nome, Telefone, Bi)
values('$nome', '$telefone', '$bi')";
mysql_query("DELETE FROM teste2 WHERE BI='0' or Telefone='0'");
mysql_db_query($bd,$query,$ligacao);
mysql_select_db($bd, $ligacao) or die(mysql_error($bd));
mysql_select_db("teste2");
$resultado=mysql_query("SELECT * FROM teste2");
while($linha=mysql_fetch_array($resultado))
{
echo $linha['nome']; echo $linha['telefone']; echo $linha['bi'];
}
?>
For some reason it´s blank. It shows nothing except the hyperlinks for the rest of the page. Can someone tell me what is wrong?
<?php
$nome=$_POST['nome'];
$telefone=$_POST['telefone'];
$bi=$_POST['bi'];
echo "<a href=http://localhost/grupoN12-19/12-19.html>Inserir Registo</a>"; echo("<br>");
echo "<a href=http://localhost/grupoN12-19/12-19-update.php>Actualizar um registo</a>"; echo("<br>");
echo "<a href=http://localhost/grupoN12-19/12-19-delete.php>Apagar um registo</a>";
$ligacao=mysql_pconnect("localhost", "root","");
$bd="n12-n19";
$query="insert into teste2(Nome, Telefone, Bi)
values('$nome', '$telefone', '$bi')";
mysql_query("DELETE FROM teste2 WHERE BI='0' or Telefone='0'");
mysql_db_query($bd,$query,$ligacao);
mysql_select_db($bd, $ligacao) or die(mysql_error($bd));
mysql_select_db("teste2");
$resultado=mysql_query("SELECT * FROM teste2");
while($linha=mysql_fetch_array($resultado))
{
echo $linha['nome']; echo $linha['telefone']; echo $linha['bi'];
}
?>