So I want to get each table name in a MYSQL database and put it in the variable database. This is what I have so far but I cant seam to get it working, thanks in advance! It just says "Access denied for user ''@'localhost' to database 'mynotesdatabase'" But when I print out the actual rows of the tables it works but not when I want to print out the table names.
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else{
echo "Connected", "<br/>";
}
$query = mysql_query("SHOW TABLES FROM mynotesdatabase") or die(mysql_error());
while($row = mysql_fetch_array($query)) {
$database = $query;
$result = mysqli_query($con,"SELECT * FROM $database");
echo "<b>+" . $database . "</b><br/>";
while($row = mysqli_fetch_array($result))
{
$type = "";
if($row['Type'] == 0){
$type = "Link";
}
else{
$type="Note";
}
echo "  -" . $row['Name'] . " (" . $type . ")";
echo "<br>";
}
}
mysqli_close($con);