Unstoppable Domains โ€” Get your daily AI drops report

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
•••
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
•••
Truehost โ€” .com domains from $4.99, hosting includedTruehost โ€” .com domains from $4.99, hosting included
Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back