目录新闻主题错误MySQL_Error()

时间:2015-07-02 作者:armia

我在我的wordpress网站上安装了directorypress主题,除了“我的购买历史”这一部分的sql错误外,其他都可以正常工作,但我无法处理我想删除这个错误或从父页面隐藏“我的购买历史”链接有什么想法吗?

这部分的代码是

function MYORDERS($user_id){

global $wpdb,$PPT, $ThemeDesign, $userdata; get_currentuserinfo(); $content=""; $dwl_content=""; $td=1; $STRING =\'<input type="hidden" value="" id="moreinfodiv" name="moreinfodiv">\';
$date_format = get_option(\'date_format\') . \' \' . get_option(\'time_format\');
if(!is_numeric($user_id)){ die("nice try!"); }


$SQL = "SELECT * FROM ".$wpdb->prefix."orderdata WHERE cus_id=\'".$userdata->ID."\' GROUP BY order_id ORDER BY autoid DESC";  

$posts = mysql_query($SQL, $wpdb->dbh) or die(mysql_error().\' on line: \'.__LINE__);

  if ($posts && mysql_num_rows($posts) > 0) {

    while ($thepost = mysql_fetch_object($posts)) { if($thepost->order_total > 0){

    if($thepost->order_status ==0){  
    $status = $PPT->_e(array(\'myaccount\',\'_paymentstatus0\'));
    }elseif($thepost->order_status ==3){ 
    $status = "<b style=\'color:green;\'>".$PPT->_e(array(\'myaccount\',\'_paymentstatus1\'))."</b>";
    }elseif($thepost->order_status ==5){ 
    $status = "<b style=\'color:green;\'>".$PPT->_e(array(\'myaccount\',\'_paymentstatus2\'))."</b>";
    }elseif($thepost->order_status ==6){  
    $status = "<b style=\'color:red;\'>".$PPT->_e(array(\'myaccount\',\'_paymentstatus3\'))."</b>";
    }elseif($thepost->order_status ==7){ 
    $status = "<b style=\'color:blue;\'>".$PPT->_e(array(\'myaccount\',\'_paymentstatus4\'))."</b>";
    }elseif($thepost->order_status ==8){ 
    $status = "<b>".$PPT->_e(array(\'myaccount\',\'_paymentstatus5\'))."</b>";
    }  
error

the parent page

1 个回复
最合适的回答,由SO网友:armia 整理而成

谢谢大家,我知道了我把代码改成

 $SQL = "SELECT * FROM 
   ".$wpdb->prefix."orderdata
   WHERE cus_id=\'".$userdata->ID."\' 
   GROUP BY order_id 
   ORDER BY autoid DESC"; 
$results = $wpdb->get_results($SQL);
解决了问题

结束

相关推荐

Wp-login.php只是刷新表单域

我最近将一个客户博客从一个服务器移动到了另一个服务器。从表面上看,一切似乎都很好——博客正在运行,你可以查看没有问题的条目。我们遇到的问题是管理员登录页面。当您输入用户名和密码时,它只会刷新页面。不会显示任何错误消息或提示。我遵循了本页上的提示:http://codex.wordpress.org/Login_TroubleCookies are enabled, tried via several browsers Plugins folder has been renamed to plugi