我试图在插件文件中使用wpdb但由于某种原因我没有得到错误,只是没有结果。
我只是想从表格中获取一些信息并向最终用户显示任何关于其无法正常工作的想法
function show_forminfo(){
global $wpdb;
$sql = "SELECT * FROM 4hSIc_pods_player_ranking WHERE player_id='".$playerId."'";
$clientRow = $wpdb->get_row( $wpdb->prepare($sql));
echo $clientRow->points_to_redeem;
echo "<div id='infopoints' class='modal fade' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>";
echo "<div class='modal-dialog'>";
echo "<div class='modal-content'>";
echo "<div class='modal-header'>";
echo "<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>";
echo "<h4 class='modal-title'>Redeem Points</h4>";
echo "</div>";
echo "<form class='form-horizontal' class='contact' name='redemmpointsForm' id='redemmpointsForm' >";
echo " <div class='form-group'>";
echo "<h3>You have points pending:<br />";
echo "".$clientRow->points_to_redeem;
echo "<input type='hidden' name='playerid' value='<?php echo $playerId;;?>' />";
echo " </div>";
echo " <div class='form-group'>";
echo " <div class='col-md-6'>";
echo " <a href='#' class='btn btn-info' data-dismiss='modal'>Close</a>";
echo " </div>";
echo " </div>";
echo "</form>";
echo " </div>";
echo " </div>";
echo " </div>";
}
答案 0 :(得分:1)
您需要包含wp-load.php
require( '/path/to/wp-load.php' );