1
I’m trying to get information from my database but it’s not returning content, only a fake boolean:
require_once "config.php"; // database
$sql = mysql_query("SELECT * FROM home") or die("MySQL error:".mysql_error());
$result = mysql_fetch_array($sql);
var_dump($result);
//echo $result['conteudo'];
while($info = mysql_fetch_array( $sql )) {
echo $info['conteudo'];
}
A photo of the result: http://prntscr.com/2xu5to
Any idea what might be going on?
possible duplicate of Error while collecting database information
– bfavaretto
I believe the mistake is another
– Junior CT
But in the other question we come to no conclusion about the error. It is the same code, giving the same problem. So I consider the same question...
– bfavaretto
In fact the other problem was that nothing was happening, and this is the result returning a boolean instead of the text, it would make no sense to edit the other question...
– Junior CT
There’s something on the table
home
? Themysql_fetch_array
only returnsfalse
when the result is empty.– bfavaretto
Yes, as you can see in this photo: http://prntscr.com/2xu87c
– Junior CT
This print shows that the table has a defined column, but not that it contains data.
– bfavaretto
By the way, home is a table or is the name of the bank?
– bfavaretto
is a table, and I found a problem, apparently it had not been created the data I had inserted, created and now it appears in the page: array (size=2) 0 => string ' ' (length=1) 'content' => string ' (length=1) 0
– Junior CT
Problem solved then? I posted my comment as reply.
– bfavaretto