Is it advisable to use the 'DESC SELECT' approach to gather information about field types and unlisted fields in MySQL databases for a search engine?

Using the 'DESC SELECT' approach to gather information about field types and unlisted fields in MySQL databases for a search engine is not advisable as it can be inefficient and may not provide accurate results. Instead, it is recommended to use the 'SHOW COLUMNS' query to retrieve information about table structure and field types in MySQL databases.

// Connect to MySQL database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Query to retrieve information about table structure and field types
$sql = "SHOW COLUMNS FROM table_name";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // Output data of each row
    while($row = $result->fetch_assoc()) {
        echo "Field: " . $row["Field"]. " - Type: " . $row["Type"]."<br>";
    }
} else {
    echo "0 results";
}

$conn->close();