Dynadot โ€” .com Transfer

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.
AfternicAfternic
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
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
CatchedCatched
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back