Insert update and delete in WordPress.
In the core php, we need to write at-least 10 to 15 lines, sometimes more than that for the database connection and insert update or delete operations on the database..
But in the wordpress we just need a single line for the opration and no need to connect to database. Because this steps are done at the installation only.
INSERT QUERY :
$wpdb->insert( $table, $data, $format );
table (string):
The name of the table.
data (array):
Data to insert in column => value pairs.
format (array|string) : (optional)
An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
UPDATE QUERY :
$wpdb->update( $table, $data, $where, $format = null, $where_format = null );
table (string) :
The name of the table to update.
data (array) :
Data to update in column => value pairs.
where (array) :
A named array of WHERE clauses in column => value pairs. Multiple clauses will be joined with ANDs.
format (array|string) :(optional)
An array of formats to be mapped to each of the values in $data. If string, that format will be used for all of the values in $data.
where_format (array|string) : (optional)
An array of formats to be mapped to each of the values in $where. If string, that format will be used for all of the items in $where.
Possible format values:
%s as string; %d as decimal number and %f as float. If omitted, all values will be strings.
DELETE QUERY :
$wpdb->query(‘query’);
query (string) :
The SQL query you wish to execute for deletion.
Its really very easy to play with database in the WordPress.
Start to do that and enjoy coding.
You may like to read this also....
1 Comment to “Insert update and delete in WordPress.”
Post comment
Search in this website
our sponsors
latest comments
- sagar on List of all standard version of c language
- Mohit Dhukia on How to access/unblock songs.pk in india?
- shinto peter on How to configure mail from localhost ( wamp ) using PHP?
- tammylleanne on Implementation limitation of c programming language
- Deepak on How to access/unblock songs.pk in india?
Find us on Facebook
Top Authors
Find us on stackoverflow
Polls
My Bookmarks
- Audio/video Recorder & player application based on MATLAB
- check dependency of your binary
- defination of all standard c programming language function
- Great Question-Answer on c programming
- know what your c code means
- Limition of c programming language
- List of all version of c programming language
- Online c compiler
- php freelancing work
- some more stuff on C programming language
- Volatile Keyword in Embedded System
- Write Android application in c language
Hi,i am new to wordpress,unable to connect the form to the database,how to use the functions???????????? Please help….