Wordpress plugin help

SpaceshipSpaceship
SpaceshipSpaceship
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
Close
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
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Member card: see how many threads a member started
The member card now shows a Threads number, right after Posts. The member card is the box that opens when you point at a name. Profile...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back