input: Write a function named `sample_data_from_databases` that connects to MySQL, MongoDB, and PostgreSQL databases, queries data based on predefined queries, and then displays the queried data on a webpage. The function should handle the connection and disconnection to each database, execute the queries, and render the results on the webpage. If any database connection fails, the function should handle the exception and continue with the remaining databases.
  assert sample_data_from_databases()
  assert sample_data_from_databases()
output: 
  def sample_data_from_databases():
      import mysql.connector
      from pymongo import MongoClient
      import psycopg2
      from flask import Flask, render_template_string
  
      app = Flask(__name__)
  
      mysql_data = []
      mongodb_data = []
      postgresql_data = []
  
      try:
          mysql_conn = mysql.connector.connect(
              host="localhost",
              user="root",
              password="password",
              database="mysql_db"
          )
          mysql_cursor = mysql_conn.cursor()
          mysql_cursor.execute("SELECT * FROM mysql_table LIMIT 10")
          mysql_data = mysql_cursor.fetchall()
          mysql_cursor.close()
          mysql_conn.close()
      except Exception as e:
          print(f"MySQL connection failed: {e}")
  
      try:
          mongo_client = MongoClient("mongodb://localhost:27017/")
          mongo_db = mongo_client["mongodb_db"]
          mongo_collection = mongo_db["mongodb_collection"]
          mongodb_data = list(mongo_collection.find().limit(10))
          mongo_client.close()
      except Exception as e:
          print(f"MongoDB connection failed: {e}")
  
      try:
          postgresql_conn = psycopg2.connect(
              host="localhost",
              database="postgresql_db",
              user="postgres",
              password="password"
          )
          postgresql_cursor = postgresql_conn.cursor()
          postgresql_cursor.execute("SELECT * FROM postgresql_table LIMIT 10")
          postgresql_data = postgresql_cursor.fetchall()
          postgresql_cursor.close()
          postgresql_conn.close()
      except Exception as e:
          print(f"PostgreSQL connection failed: {e}")
  
      @app.route('/')
      def display_data():
          return render_template_string('''
              <h1>MySQL Data</h1>
              <ul>
                  {% for item in mysql_data %}
                  <li>{{ item }}</li>
                  {% endfor %}
              </ul>
              <h1>MongoDB Data</h1>
              <ul>
                  {% for item in mongodb_data %}
                  <li>{{ item }}</li>
                  {% endfor %}
              </ul>
              <h1>PostgreSQL Data</h1>
              <ul>
                  {% for item in postgresql_data %}
                  <li>{{ item }}</li>
                  {% endfor %}
              </ul>
          ''', mysql_data=mysql_data, mongodb_data=mongodb_data, postgresql_data=postgresql_data)
  
      app.run(debug=True)
  