In PHP, many functions have also been created to access the current date and time so that it can show the correct time and date according to your time zone. PHP Date & Time Function with Example, PHP Date/Time Functions, PHP 5 Date and Time Functions, How do I get the current date and time […]
See MoreCategory: PHP
include() and require() function Use in PHP
In PHP, the content of another file is used in one file. For this, PHP has given two functions. Include() Function. Required() Fucntion. PHP program is easy to use by using them. This avoids the programmer’s time. The larger script becomes smaller. Any external php files are used in a PHP file. PHP Include and […]
See MoreHow Can I Sort Records Order By Using Mysqli and PDO?
The ORDER BY clause is used with the SELECT statement. Here the records of the table are sorted by the column ascending (ASC) and descending (DESC) order. Note: If ASC or DESC keyword is not used then ASC default is set. SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC Example for Sorting Records with ORDER […]
See MoreSelect Limit Records Using Mysqli and PDO
The LIMIT clause returns the number of rows from the table.The LIMIT clause is used in PHP for Pagination with MySQL. When MySQL has very number of rows. Then pagination is divided into separate pages with LIMIT clause. This also decreases the page size and page loading. Example for LIMIT clause using MySQLi <?php $conn […]
See MoreHow Can I Select Records into Table Using Mysqli and PDO?
When records are inserted into a table, a ‘SELECT’ statement is used to retrieve that record. Here, this syntax is used to retrieve records from a single column of a table. SELECT column_name (s) FROM table_name Here this syntax is used to retrieve records from all the columns of a table. SELECT * FROM table_name […]
See MoreHow Can I Delete Records Into Table Using Mysqli and PDO?
WHERE clause is used with DELETE table_name statement when row or record is to be deleted. DELETE FROM table_name WHERE column_name=some_value Example for DELETE statement using MySQLi <?php $server = “localhost”; $user = “root”; $password = “”; $db = “expertstutorials”; $conn = mysqli_connect($server, $user, $password, $db); if($conn){ echo “Connected successfully.”; } else{ echo “Connection failed […]
See MoreHow Can I Update Record into Table Using Mysqli and PDO?
UPDATE Statement is used to update the records of MySQL table. Some changes are made to the rows given by the update statement. UPDATE table_name SET column 1 = newvalue 1, column 2 = newvalue 2, …, column n = newvalue n WHERE column = value The program uses SET and WHERE clause with UPDATE […]
See MoreHow Can I Insert Record into Table Using Mysqli and PDO?
When the table is created, this statement ‘INSERT INTO table_name’ is used to insert records into it. To insert records in a table,The columns are not written under double (“”) or single (”) quotes.When numeric data type values are written then they are not written in double or single quotes.String values are given double or […]
See MoreHow to Delete (Drop) Table Using Mysqli or PDO?
A ‘DROP TABLE table_name’ statement is used to delete the table. Keywords :- How can i delete table with mysqli and pdo, delete table using pdo & mysqli For Example Delete Table using MySQLi Code Syntax :- <?php $server = “localhost”; $user = “root”; $password = “”; $db = “expertstutorials”; $conn = mysqli_connect($server, $user, $password, […]
See MoreHow to Create Table Using Mysqli or PDO?
Many tables are created in a MySQL database.CREATE TABLE table_name This statement is used to create a table in the database. Here the table named ‘Course’ is taken and three fields id, course_name and course_year are taken in it. Example or Creating Table Structure CREATE TABLE Course( id INT(2) AUTO_INCREMENT PRIMARY KEY, course_name VARCHAR(150) NOT […]
See More