Hi there! I am currently trying to create a PHP script whereby there is already a login script created and the user that successfully logs into the home.php is able to view the tables of the database he is logged into.
Is there any ways of retrieving the tables using the mySQL query like "SHOW TABLES"?
Here are some of my codes:
<?php
session_start();
if($_SESSION['id'])
{
echo "Welcome ",$_SESSION['username']."<br>";
echo "Click here to Logout : ".'<br><a href="logout.php">Logout</a>';
}
else
{
echo "You don't belong here!";
}
$tableSQL = "SHOW TABLES";
$tablesoutput = mysql_query($tableSQL);
print $tablesoutput;
?>
I think my codes are wrong as there are errors showing that access is denied to the database. Does it mean that I have to reconnect to the database even though I have a session established?
Please do help. Thanks.