Accessing data from custom DB Table

25 sec read

Dear Developer

Accessing database to make a site dynamic is something that every PHP developer encounters with. But every time there are game changer newbie in the town.

The most important point for accessing data from custom DB Table is to have a custom DB table. Rest other things are secondary.

Algorithm

1. Create a db table in db created by word press installation. keep prefix wp_ before table name.
2. Access this table via get_results() method called on word press db object.

Pseudo Code snippet

global $wpdb;
$categoryArray = $wpdb->get_results("SELECT DISTINCT CATEGORY_ID FROM `wp_blogs_table` WHERE PARENT_CATEGORY=0;"); 

Use this code to access dynamic data from a database in your word press pages.

Happy Coding

Thanks

Sending Email Via PHP

Dear Friends Today we are going to learn how to send email via php So lets us assume a scenario where this problem might...
user
1 min read

Adding Custom Template to WordPress Page For your Website

Dear Friends This blog post is targeted for the individuals who aspire to become an entrepreneur and want to develop their own web site...
user
59 sec read

FCM Push notification [ Server side] HTTP via PHP

Dear friends we will be having php code that can make http post request via curl to Firebase Push servers. this post request will...
user
35 sec read