Wordpress plugin help

SpaceshipSpaceship
Watch
Impact
18
Hello friends

I am learning Wodpress plugin development

I have creating ads plugin for now.

I have done almost everything... Now facing problem in showing data from database

database structure is

Wordpress > customads > adone

i want to show value of adone

here is code i am using

function showcustomads() {
global $wpdb;
$table = $wpdb->prefix."customads";
$sql = 'SELECT adone FROM $table WHERE id = 1;';
$t = mysql_query($sql);
if ($t==1)
{ echo $adone; }

}

it doing nothing!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
try the following instead:-

PHP:
function showcustomads() {
global $wpdb;
$table = $wpdb->prefix."customads";
$sql = 'SELECT adone FROM $table WHERE id = 1;';
$t = $wpdb->get_row($sql);
if ($t==1)
{ echo $adone; }

}

although I am not 100% sure what you are trying to do in that if statement. Also are you sure you only want to select adone from the db where the ID is 1. You not meaning to limit to 1 instead?
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Zero Commission
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back