79348908

Date: 2025-01-11 21:18:01
Score: 1.5
Natty:
Report link

Sorry for the brevity in the comment Your Common Sense,. Still getting used to Stackoverflow. Thank you for your reply. It has been very helpful. How about:

require_once("db_fns2025.php");

// Query to get table names
$sql = "SHOW TABLES";
$rs =  mysqli_query($link, $sql);
// Check if there are tables
$tblCnt = 0;
if ($rs->num_rows > 0) {
echo "<h2>Tables in the $dbname database:</h2>";
echo "<ul>";
// Output data from each row
while ($row = $rs->fetch_array()) {
$tblCnt++;
echo "<li>" . $row[0] . "</li>";
 }
echo "</ul>";
 if ($tblCnt==1) {
 echo "There is $tblCnt table<br />\n";
}
else if ($tblCnt>1){
 echo "There are $tblCnt tables<br />\n";
} 
} else {
echo "No tables found in the $dbname database.";
}
mysqli_close($link);
?>
Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Blacklisted phrase (1): Stackoverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Mark P