Html webpage for MYSQL DB

#2
by deleted - opened
deleted

๐Ÿ˜ƒ: Create a html webpage for storing SQL database links of images
๐Ÿค–: Creating a full webpage involves HTML, CSS, and possibly a bit of JavaScript. However, for simplicity, let's create a basic example with HTML.

This example will only show you how to build the structure. You will need to build a server-side language like PHP or Node.js to fetch and display images from your SQL database and save them into your database.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Image Database</title>
    <style>
        img {
            max-width: 200px;
            height: auto;
        }
    </style>
</head>
<body>
    <h1>Image Links from Database</h1>
    <div id="image-container">
        <!-- Your images will be displayed here -->
    </div>

    <script>
        // Assuming you have a fetched array named 'images' that contains objects with 'url' and 'id' properties
        var images = [
            {id: 1, url: 'http://example.com/image1.jpg'},
            {id: 2, url: 'http://example.com/image2.jpg'},
            {id: 3, url: 'http://example.com/image3.jpg'}
        ];

        var imageContainer = document.getElementById('image-container');

        for (var i = 0; i < images.length; i++) {
            var imgElement = document.createElement('img');
            imgElement.src = images[i].url;
            imageContainer.appendChild(imgElement);
        }
    </script>
</body>
</html>

Remember to adapt this to fit your specific requirements and you'll need to replace the URLs in the 'images' array with the links you fetched from your SQL database.

For connecting to a SQL database and fetching URLs, you'll need to use a server-side language and connect to your database, execute SQL queries to fetch the URLs and pass them to the client-side JavaScript. This is out of scope for this basic example and you would typically do this using a backend language like PHP, Node.js, Python, etc.

Sign up or log in to comment