{"id":26289913,"url":"https://github.com/codex2124/image-upload-and-display-using-php-mysql","last_synced_at":"2025-03-14T23:16:52.830Z","repository":{"id":273648455,"uuid":"919579451","full_name":"CodeX2124/Image-Upload-and-Display-using-PHP-MySQL","owner":"CodeX2124","description":"It is the simple web application that allows users to input details, upload photos, and displays user information, including photos.","archived":false,"fork":false,"pushed_at":"2025-01-23T15:01:10.000Z","size":5082,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T23:12:38.666Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeX2124.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-20T16:45:24.000Z","updated_at":"2025-02-11T16:39:46.000Z","dependencies_parsed_at":"2025-01-22T06:42:19.279Z","dependency_job_id":null,"html_url":"https://github.com/CodeX2124/Image-Upload-and-Display-using-PHP-MySQL","commit_stats":null,"previous_names":["codev124/image-upload-and-display-using-php-mysql","codex2124/image-upload-and-display-using-php-mysql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeX2124%2FImage-Upload-and-Display-using-PHP-MySQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeX2124%2FImage-Upload-and-Display-using-PHP-MySQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeX2124%2FImage-Upload-and-Display-using-PHP-MySQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeX2124%2FImage-Upload-and-Display-using-PHP-MySQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeX2124","download_url":"https://codeload.github.com/CodeX2124/Image-Upload-and-Display-using-PHP-MySQL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658258,"owners_count":20326467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-14T23:16:52.360Z","updated_at":"2025-03-14T23:16:52.809Z","avatar_url":"https://github.com/CodeX2124.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Photo Upload and Display - PHP Assignment\n\nThis PHP project is a simple web application that allows users to input details, upload photos, and displays user information, including photos.\n\n## Prerequisites\n\n- PHP development environment (e.g., XAMPP, WampServer).\n- MySQL database.\n- Create a \"uploads\" folder in the project directory to store uploaded images.\n\n## Getting Started\n\n1. Clone or download the project to your local machine.\n2. Set up your MySQL database and update the connection details in `connect.php`.\n3. Create a folder named \"uploads\" in the project directory.\n4. Open the project in your PHP development environment.\n\n## Database Setup\n\n1. **Create a MySQL database named \"assignment\":**\n\n    ```sql\n    CREATE DATABASE assignment;\n    ```\n\n2. **Create a \"user\" table within the database:**\n\n    ```sql\n    CREATE TABLE user (\n      id INT AUTO_INCREMENT PRIMARY KEY,\n      name VARCHAR(255) NOT NULL,\n      description TEXT,\n      photo VARCHAR(255)\n    );\n    ```\n\n## File Structure\n\n- **connect.php:** Database connection details.\n- **index.php:** User input form and photo upload.\n- **handleInput.php:** Handles form submission, uploads photos, and inserts user details into the database.\n- **displayUserDetails.php:** Displays user details, including photos, in a table.\n\n## Usage\n\n### 1. Input User Details and Upload Photo\n\nOpen `index.php` in your browser, fill in the form with user details, select a photo, and click \"Submit.\" The photo will be uploaded to the \"uploads\" folder, and user details will be stored in the database.\n\n```php\n\u003c!-- index.php --\u003e\n\n\u003c!-- ... --\u003e\n\n\u003cform action=\"handleInput.php\" method=\"post\" enctype=\"multipart/form-data\"\u003e\n  \u003c!-- ... --\u003e\n\n  \u003c!-- Input field for user's photo --\u003e\n  \u003cdiv class=\"mb-3\"\u003e\n    \u003clabel for=\"photo\" class=\"form-label\"\u003ePhoto\u003c/label\u003e\n    \u003cinput type=\"file\" class=\"form-control\" id=\"photo\" name=\"photo\" accept=\"image/*\"\u003e\n  \u003c/div\u003e\n\n  \u003c!-- ... --\u003e\n\n  \u003cbutton type=\"submit\" class=\"btn btn-primary\" name=\"submit\"\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n\n\u003c!-- ... --\u003e\n```\n\n### 2. Display User Details with Photos\n\nVisit `displayUserDetails.php` in your browser to view a table displaying user details, including photos.\n\n```php\n\u003c!-- displayUserDetails.php --\u003e\n\n\u003c!-- ... --\u003e\n\n\u003c!-- Loop through each user record --\u003e\nwhile ($row = mysqli_fetch_assoc($result)) {\n  $id = $row[\"id\"];\n  $name = $row[\"name\"];\n  $description = $row[\"description\"];\n  $photo = $row[\"photo\"];\n\n  echo\n    '\u003ctr\u003e\n      \u003cth scope=\"row\"\u003e' . $id . '\u003c/th\u003e\n      \u003ctd\u003e' . $name . '\u003c/td\u003e\n      \u003ctd\u003e' . $description . '\u003c/td\u003e\n\n      \u003c!-- Display user photo --\u003e\n      \u003ctd\u003e\u003cimg src=\"uploads/' . $photo . '\" alt=\"User Photo\" style=\"width: 75px; height: 75px;\"\u003e\u003c/td\u003e\n    \u003c/tr\u003e';\n}\n\n\u003c!-- ... --\u003e\n```\n\u003cbr\u003e\n\n## More\n[CRUD APP using PHP MySQl](https://github.com/AmanKumarSinhaGitHub/CRUD-App-using-PHP-MySQL)\n\n[Live Demo](https://php-mysql-crud-app.000webhostapp.com/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodex2124%2Fimage-upload-and-display-using-php-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodex2124%2Fimage-upload-and-display-using-php-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodex2124%2Fimage-upload-and-display-using-php-mysql/lists"}