source
Creating a Database:
Step 1:
In this second part, I will create a database in phpMyAdmin and will set the database name "otp_verification" you can set whatever you want but in the meantime your need to set the database name in the config.php file which will be created in the next step.
After creating the database you need to create a table.
select the database copy the below code and past in it SQL tab and click go to create a table.
CREATE TABLE `user` (`uid` int(11) NOT NULL,`name` varchar(255) NOT NULL,`email` varchar(255) NOT NULL,`password` varchar(255) NOT NULL,`signup_time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),`otp` varchar(255) NOT NULL,`activation_code` varchar(255) NOT NULL,`reset_code` varchar(255) NOT NULL,`status` varchar(255) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;ALTER TABLE `user`ADD PRIMARY KEY (`uid`);ALTER TABLE `user`MODIFY `uid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=0;
Step 2:
After creating the database and table you need to create a database connection file. I will create the file with the name config.php.
config.php
<?php$conn = mysqli_connect("localhost", "root", "", "otp_verification");if (!$conn) {echo "Connection Failed ".mysqli_connect_error() or die();}?>
Can you provide code please.
ReplyDeletesignup_time me invalid value show kar raha hi table save nahi hora hi.#1067 error code show...what?
ReplyDeletePost a Comment