Error collecting database information

-1

I'm having a problem getting information from a database, the code I tried was this:

require_once "config.php"; // database
$sql = mysql_query("SELECT conteudo FROM home NULL NULL NULL") or die("MySQL error:".mysql_error()); 
$result = mysql_fetch_array($sql);
echo $result;

Only nothing happens, does not the information I get from the database appear, any idea of what is happening?

NOTE: If there is an error on the page, here is the code:

<html>
<head>
<title>Trilhas da Terra</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="UTF-8">
</head>
<body>
<div id="menu">
<ul class="main">
<li><a class="item" href="index.html"><div>Home</div></a></li>
<li><a class="item" href="quem.html"><div>Quem Somos</div></a></li>
<li><a class="item" href="roteiros.html"><div>Roteiros</div></a></li>
<li><a class="item" href="portfolio.html"><div>Portfolio</div></a></li>
<li><a class="item" href="contato.html"><div>Contato</div></a></li>
<li style="float:right;"><a class="item" href="login.html"><div>Admin</div></a></li>
</ul>
</div>
<div id="logo"><img src="imagens/logo.jpg"></div>
<div id="info">
<div id="wtitle">Home</div>
<br>
<div id="wcont">
<?php
require_once "config.php"; // database
$sql = mysql_query("SELECT conteudo FROM home NULL NULL NULL") or die("MySQL error:".mysql_error()); 
$result = mysql_fetch_array($sql);
echo $result;

?>

</div>
</div>
<div id="widside">
<div id="wtitle">Trilhas do Barro Serra do Mar</div>
</div>
<script src="some.js"></script>
</body>
</html> 
    
asked by anonymous 04.03.2014 / 16:19

1 answer

2

If you do not want to create any clause for your query, just do not type anything, the NULLS you added is accusing syntax error. Leave your query as mysql_query("SELECT conteudo FROM home") that should work.

Always remember that: 'content' refers to COLUMN, while 'home' is the TABLE of the database and not the name of the database itself. You must have made some confusion about these concepts. If you do not succeed, make sure that the config.php file is successfully connecting and that the column and table name have been entered correctly.

    
05.03.2014 / 17:33