HOME/posts/php-mysql-crud-server-action

PHP mysql CRUD Operation

Published On

Folder Structue

  • css
    • - style.css
    • images
      • - student.png
      • includes
        • - navbar.php
        • - add-user.php
          • - edit-profile.php
            • - index.php
              • - search-result.php
                • - user-profile.php

                  Introduction

                  In this lesson, I will create a full crud operation using PHP and MySql(Mysqli)

                  Sql

                  CREATE TABLE `users` (
                    `id` int(11) NOT NULL,
                    `fullName` varchar(400) DEFAULT NULL,
                    `nameWithInitials` varchar(200) DEFAULT NULL,
                    `nic` varchar(12) NOT NULL,
                    `course` varchar(100) NOT NULL,
                    `indexNo` varchar(200) DEFAULT NULL,
                    `email` varchar(255) DEFAULT NULL,
                    `contactno` varchar(11) DEFAULT NULL,
                    `posting_date` timestamp NOT NULL DEFAULT current_timestamp()
                  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
                   
                  ALTER TABLE `users`
                    ADD PRIMARY KEY (`id`);
                   
                  ALTER TABLE `users`
                    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
                  COMMIT;
                   

                  Happy coding!