What is concept of object oriented programming language?
PHP Crud using OOP's Concept: OOP stands for Object Oriented programming, it can be faster or easy to execute. It make code reusable that save our time and efforts.
Mysql Database using OOPS:
1.Create connection with Database using OOP: When create a new database with createing class and its object, we must specify the four arguments to the mysqli object (servername, username, password and datbase name).
syntax, $variable = mysqli_connect("Srvername","username","password","database_Name");
2.Insert data into Database using OOP: We can use properties and object of parent class into child class using "extends" keyword. If we want insert data into database create a table into database give columns name, type and it's length. Then create a file for insertion using sql query command. We also give static and dynamic values in database by passing parameters.
syntax, INSERT INTO table_name (give table fields name) VALUES (''));
3.Select data from database: If can simply select data from data base using SELECT query command. It can be used for select all the data and single data.
syntax for select whole row in a table, $variable = mysqli_query(SELECT * FROM table_name);
syntax for select single row in a table, $variable = mysqli_query(SELECT * FROM table_name WHERE id='value');
Mysql Database using OOPS:
1.Create connection with Database using OOP: When create a new database with createing class and its object, we must specify the four arguments to the mysqli object (servername, username, password and datbase name).
syntax, $variable = mysqli_connect("Srvername","username","password","database_Name");
2.Insert data into Database using OOP: We can use properties and object of parent class into child class using "extends" keyword. If we want insert data into database create a table into database give columns name, type and it's length. Then create a file for insertion using sql query command. We also give static and dynamic values in database by passing parameters.
syntax, INSERT INTO table_name (give table fields name) VALUES (''));
3.Select data from database: If can simply select data from data base using SELECT query command. It can be used for select all the data and single data.
syntax for select whole row in a table, $variable = mysqli_query(SELECT * FROM table_name);
syntax for select single row in a table, $variable = mysqli_query(SELECT * FROM table_name WHERE id='value');
Comments
Post a Comment