WordPress Plugin Development tutorial from scratch (Part 16) Insert data to WordPress Database

In this video session i have explained about Inserting data to Database table in WordPress. Easy Steps to insert data in wordpress table. I have explained about 2 ways to do this task.


Steps to do this task:
#1: wpdb::insert( string $table, array $data, array|string $format = null )
#2: wpdb::query and wpdb::prepare

By Step $wpdb::insert,
1. wpdb::insert( ‘table’, array( ‘column’ = ‘foo’, ‘field’ = ‘bar’ ) )
2. wpdb::insert( ‘table’, array( ‘column’ = ‘foo’, ‘field’ = 1337 ), array( ‘%s’, ‘%d’ ) )

‘table’: table_name of wordpress database

By Step $wpdb::query,
We have to use $wpdb::prepare to make Safe Execution of MySql Query
“Insert into table_name (col1, col2, col2,…) values( %s, %d, %s, …)”,string_value,integer_value,…
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. A format is one of ‘%d’, ‘%f’, ‘%s’ (integer, float, string).

Documenation Study Notes:



Create database table dynamically by WordPress Plugin,
Click here to watch: https://www.youtube.com/watch?v=nzRyFF95jXI

Drop table when WordPress Plugin deactivates/uninstalls
Click here to watch: https://www.youtube.com/watch?v=sa28dHu6YCA

ajax request, To make Ajax request Click here to learn:
By Method #1: https://www.youtube.com/watch?v=n_3nXW8VzgQ
By Method #2: https://www.youtube.com/watch?v=RAwahYG8Qfc

How we add custom javascript code to wordpress plugin page:
Click here to watch: https://www.youtube.com/watch?v=CUt8trEQkPc

Subscribe : https://www.youtube.com/channel/UCB2flCo-gW6RhpVVXySqcMg
FACEBOOK : https://www.facebook.com/onlinewebtutorhub/
TWITTER: https://twitter.com/owthub
BLOG: https://onlinewebtutorhub.blogspot.in/

1. Some knowledge of PHP, HTML for this video series
2. How to Install WordPress: https://www.youtube.com/watch?v=MREgql9jmf0

Also you can learn WordPress Custom
Theme Development: https://www.youtube.com/watch?v=MREgql9jmf0&list=PLT9miexWCpPV9WxY_QG3qxUGKzw54LboW
Widget Development: https://www.youtube.com/watch?v=ZSbdYG1svV8&list=PLT9miexWCpPUgibUXDZ7JP1j3U-m61U8m

online web tutor,
profotech solutions,
wordpress plugin development from scratch in hindi,
wordpress plugin development from scratch in easy steps,
wordpress plugin development,
wordpress plugin development in easy steps,
plugin development in wordpress from scratch in hindi,
plugin development in wordpress by online web tutor,
plugin development in wordpress tutorials from scratch in hindi,
plugin theme development tutorials in hindi,
plugin development tutorials in hindi,
owt tuts,
online web tutorials,

Online Web Tutor
Keep learning and Sharing 🙂

Please watch: “Learn backbone.js tutorial from scratch”


About admin

Leave a Reply

Your email address will not be published. Required fields are marked *