How to add template in codeigniter |how to create template in codeigniter| template in codeigniter 4
Insert record into MySQL
In this tutorial I will help you How to select data or retrieve data from MySQL table in PHP programming language. There are different types of select query I will show you in this tutorial.
First connect database in your page and then select data using select query.
<?php include "db_connect.php"; ?>
Select all data from Database:
<?php include "db_connect.php"; $sql=mysqli_query($con,"SELECT * FROM Table Name"); ?>
Select data using where clause:
<?php include "db_connect.php"; $sql=mysqli_query($con,"SELECT * FROM `table name` WHERE `user name`='".$_POST['field_name']."'"); ?>
Select only one filed from MySQL table:
<?php include "db_connect.php"; $sql=mysqli_query($con,"SELECT `id` FROM Table Name"); ?>
Select data using descending order:
<?php include "db_connect.php"; $sql=mysqli_query($con,"SELECT * from `table name` ORDER BY `id` DESC"); ?>
Select data from database set Limit:
<?php include "db_connect.php"; $sql = mysqli_query($con,"SELECT * FROM table name LIMIT 10"); ?>
Related posts