1. database.sql (SQL file for creating the table)
2. database.php (For connecting to the database)
3. search.php (HTML for search feature)
Explanation:
-
SQL Table (
user_data):-
The table has columns for
id,name,email, androll_no. -
The
idis set toAUTO_INCREMENTto ensure unique IDs for each row.
-
-
database.php:-
This file connects to the MySQL database and includes the logic for handling the search functionality.
-
It sanitizes user input for the
roll_nofield usingmysqli_real_escape_stringto prevent SQL injection. -
The result of the query is stored in the
$resultvariable and used in the HTML to display the search results.
-
-
search.php:-
The page contains a simple form that lets the user search by
roll_no. -
If the search finds results, they are displayed in a Bootstrap-styled table.
-
DataTables is used to enhance the table with features like sorting and searching within the table.
-
If no results are found, a message is displayed.
-
This setup allows for a basic search feature for user_data, and you can extend this to include more fields or features as needed.

