Tutorials
×
Python
Python
Django
Numpy
Pandas
Tkinter
Pytorch
Flask
OpenCV
AI, ML and Data Science
Artificial Intelligence
Machine Learning
Data Science
Deep Learning
TensorFlow
Artificial Neural Network
Matplotlib
Python Scipy
Java
Java
Servlet
JSP
Spring Boot
Spring Framework
Hibernate
JavaFX
Java Web Services
B.Tech and MCA
DBMS
Data Structures
Operating System
Computer Network
DAA
Computer Organization
Software Engineering
Data Mining
Web Technology
HTML
CSS
JavaScript
Jquery
Angular-8
React JS
React Native
Node JS
Software Testing
Software Testing
Selenium
JIRA
JMeter
Postman
TestNG
SoapUI
Cucumber
Interview
×
Technical Interview
C
C++
Php
Java
Python
JavaScript
TypeScript
Java Interview
JDBC
Servlet
Maven
Jenkins
Spring
Spring Boot
JDB
Hibernate
JSF
Web Interview
HTML
CSS
JavaScript
Jquery
Angular
Node-JS
AJAX
Database Interview
DBMS
SQL
PL/SQL
Oracle
MySQL
MongoDB
Redis
MariaDB
Company Interviews
IBM
Adobe
Microsoft
Amazon
TCS
HCL
Wipro
DXC
Accenture
Capgemini
Space X
Ericsson
Infosy
IGate
EXL
IndiaMART
Sapient
Compiler
Python
Java
Php
C
C++
R
Html
Javascript
Typescript
Swift
Home
Python
Java
JavaScript
HTML
SQL
PHP
C#
C++
DS
Aptitude
Reasoning
Selenium
DBMS
C
Andriod
Interview Q
Phalcon Tutorial
Phalcon Tutorial
What is Phalcon
Features of Phalcon
Phalcon Installation
Phalcon First Example
Phalcon Services
Phalcon Cache
Phalcon Configuration
Phalcon Class Autoloader
Phalcon Logging
Phalcon Front-End
Phalcon Forms
Phalcon Images
Phalcon View
Phalcon Volt
Phalcon Database
Phalcon Layer
Connect to database
Insert/Update/Delete
Phalcon Transaction
Phalcon PHQL
Phalcon Models
Phalcon Model Behaviors
Phalcon Model Events
Model Transactions
Phalcon Protocol
Phalcon Cookies
Phalcon Request
Phalcon Response
Phalcon Security
Password Hashing
Phalcon (CSRF)
Phalcon i18n
Internationalization
Interview Questions
Phalcon Interview
next →
← prev
Insert/Update/Delete Rows
Inserting Rows
// Inserting data with a raw SQL statement $sql = 'INSERT INTO 'company'('name', 'year') VALUES ('javatpoint', 2010)'; $success = $connection->execute($sql); // With placeholders $sql = 'INSERT INTO 'company'('name', 'year') VALUES (?, ?)'; $success = $connection->execute( $sql, [ 'javatoint', 2010, ] ); // Generating dynamically the necessary SQL $success = $connection->insert( 'company', [ 'javatpoint', 2010, ], [ 'name', 'year', ], );
Output:
Updating Rows
// Updating data with a raw SQL statement $sql = 'UPDATE 'company' SET 'name' = 'javatpoint' WHERE 'id' = 101'; $success = $connection->execute($sql); // With placeholders $sql = 'UPDATE 'company' SET 'name' = ? WHERE 'id' = ?'; $success = $connection->execute( $sql, [ 'javatpoint', 101, ] ); // Generating dynamically the necessary SQL (another syntax) $success = $connection->updateAsDict( 'company', [ 'name' =>'New javatpoint', ], 'id = 101' // Warning! In this case values are not escaped );
Output:
Deleting Rows
// Deleting data with a raw SQL statement $sql = 'DELETE 'company' WHERE 'id' = 101'; $success = $connection->execute($sql); // With placeholders $sql = 'DELETE 'company' WHERE 'id' = ?'; $success = $connection->execute($sql, [101]); // Generating dynamically the necessary SQL $success = $connection->delete( 'company', 'id = ?', [ 101, ] );
Next Topic
Phalcon Transaction and Nested Transaction
← prev
next →
Latest Courses