Crud operations in PHP using mysqli and PHPMyAdmin

PHP MySQL CRUD involves the connection of PHP with the MySQL database and performing Create (Insert), Read (Select), Update (Modify), and Delete Operation on the table. PHP and MySQL connectivity is a very important topic while learning PHP here step by step PHP and MySQL connectivity and creat update delete and read operations are discussed using … Read more

Mysql create table statement

To create table in mysql following syntax is used

For example,

if table created without any error then it will show following statement Result:

This query will result a table with the above fields. The first column will hold number while other columns are type of varchar. Create Table in Mysql with … Read more

Alter table command to add foreign key

We have two tables company and location. First table manages company details and second table stores location detail of company. one company can span in multiple location. Initially we have created table for company and location as below.

checking the description of both table

Now We find that one company can … Read more

Drop foreign key constraints

Some times we have to drop the foreign key constraint that already exists, for that we have to first get the foreign key constraint name. To see detailed description of created table we use following query.

Result of above query is

Here we can see that company_id column is referring company tables id … Read more

Show mysql create table query

To see created table structure show create table command is used Syntax

Example

Result

To avoid showing leading and trailing dots we use \G with command syntax is as below Example

Result *************************** 1. row *************************** Table: student Create Table: CREATE TABLE student ( id int(11) DEFAULT NULL, first_name varchar(30) DEFAULT … Read more

Set time zone in mysql

To set Time zone in GMT set time_zone is used with specified time_zone value

  To check our change reflated on database use following query

 

  Read More Setting innodb_lock_wait_timeout Granting Privileges to users Show engine innodb status Finding all column name of table

creating a new user in mysql

Here we are creating user with name manish and password for manish is password;

Creating a user and force user to change password at first login for that PASSWORD EXPIRE is used.

Creating a user and expiring the password after 180 days, PASSWORD EXPIRE INTERVAL 180 DAY is used

Creating a user … Read more