MySQL does not support object-oriented style, and in your script there are at least two references to class methods.
In this paragraph, in addition to the reference in the oriented style, 0
is passed as string in front of a quantitative comparison operator. The example will work, but it is always better to treat an integer as an integer.
From:
$exibe-> num_rows > '0'
To:
mysql_num_rows($exibe) > 0
Here is the same thing, reference to methods of a class that does not even exist.
From:
$row = $exibe->fetch_assoc()
To:
$row = mysql_fetch_assoc($exibe)
Functions generate errors for methods called from variables that are not objects. In this case, you returned an E_NOTICE
Notice: Trying to get property of non-object "localarticle" on line 9
Let's also assume that in your config.php file are the connection variables, and also where you select the database, since you are using MySQL .
...
$emite = "SELECT ID, login FROM usuarios";
$exibe = mysql_query($emite);
if (mysql_num_rows($exibe) > 0) {
while($row = mysql_fetch_assoc($exibe)) {
echo "<br> id: ". $row["ID"]. " - login: ". $row["login"]. "<br>";
}
} else {
echo "0 resultados";
}
Another thing is that MySQL functions are obsolete, thus giving rise to the new and more secure functions of MySQLi which is a version of the old MySQL , but more secure, or you can also use PDO .
You can also see in this example how your script would look with MySQLi :
$conexao = mysqli_connect("localhost", "usuario", "senha", "banco_de_dados");
$emite = "SELECT ID, login FROM usuarios";
$exibe = mysqli_query($conexao, $emite);
if (mysqli_num_rows($exibe) > 0) {
while($row = mysqli_fetch_assoc($exibe)) {
echo "<br> id: ". $row["id"]. " - login: ". $row["login"]. "<br>";
}
} else {
echo "0 resultados";
}
Some references:
There are also many good answers about MySQLi and PDO here in SOpt , just search them using < a href="http: //en.stackoverflow.com#search"> site .