I'm having a bit of a weird problem. I'm trying to read data of my database, the connection works but the instruction doesn't.
I try with code that should work, query("show tables"); but this also doesn't show anything.
Application is another php in which I make the connection and configuration with the database.
use Aplication as App;
class Company {
public static function login($username, $password) {
$app = App::getSingleton();
$conn = $app->conexionBd();
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
$query = sprintf("SELECT * FROM company E WHERE E.Name= %s", $conn->real_escape_string($username));
$rs = $conn->query($query);
if ($rs)
{
$row = $rs->fetch_assoc();
$c = new Company($row['id'], $row['Name'],$row['Password']);
$rs->free();
return $c;
}
return false;
}
}
What is wrong?
Thanks in advance!