Insert Data in Database :
1 2 3 4 5 6 | <?php global $wpdb; $a=$wpdb->insert( "table_name", array( 'image' => $ad_image , 'title' => $title, 'des' => $des, 'link' => $link ), array( '%s', '%s', '%s', '%s' ) ); ?> |
Fetch Data Form Database :
1 2 3 4 5 6 | <?php global $wpdb; $data_ads = $wpdb->get_row("SELECT * FROM table_name"); ?> <?php echo $data_ads->image; ?> |
For Display row from database use column name e.g. “<?php echo $data_ads->image; ?>”. Instead of ‘image’ you can use any column name. id,name,image etc.