0
致命錯誤:調用成員函數對/ home/dbc/public_html/CEHPLearning /可溼性粉劑內容/主題/ cehpLearning /上線47致命錯誤:調用成員函數對非對象的查詢()(wordpress 3..5)
<div class="content-page">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="the-post-container">
<?php if (!get_meta('hide_title')) : ?>
<header class="entry-header">
<!-- Title/Page Headline -->
<h1 class="entry-title" title="<?php echo the_title_attribute('echo=0'); ?>"><?php the_title(); ?></h1>
</header>
<?php endif; ?>
<!-- Page Text and Main Content -->
<div class="entry-content clearfix">
<?php
$error = '';
$success = '';
$user_id = get_current_user_id();
if(isset($_POST['task']) && $_POST['task'] == 'reset') {
$password = $_POST['pwd1'];
$con_password = $_POST['pwd2'];
if($password == "" || $con_password == "") {
$error = 'Password field is required.';
} else if($password <> $con_password){
$error = 'Password does not match.';
} else {
$qry = $wpdb->query("UPDATE $wpdb->users SET user_pass = '".md5($password)."' WHERE ID=$user_id ");
if($qry) {
$success= 'Password updated successfully, it will take effect in your next login.';
}
}
}
?>
<?php the_content(); ?>
<div class="pwChangeBox">
<form name="frmreset" id="frmreset" action="" method="post">
<h3>Don't like your password?<br/>
<span>Try a new one.</span></h3><br/>
<div class="msgBox"> <?php if($error != "") : echo '<p class="errormsg">'.$error.'</p>'; endif; if($success != "") : echo '<p class="successmsg">'.$success.'</p>'; endif; ?> </div>
<label>Password</label><br/>
<input type="password" value="<?php echo (isset($_POST['pwd1']) ? $_POST['pwd1'] : ''); ?>" name="pwd1" id="pwd2" /><br/>
<br/>
<label>Password Again</label><br/>
<input type="password" value="<?php echo (isset($_POST['pwd2']) ? $_POST['pwd2'] : ''); ?>"" name="pwd2" id="pwd2" /><br/>
<br/>
<button type="submit" class="alignleft" >SUBMIT</button>
<input type="hidden" name="task" value="reset" />
</form>
</div>
</div>
</article>
</div>
有問題的線是頁面密碼reset.php ....
$qry = $wpdb->query("UPDATE $wpdb->users SET user_pass = '".md5($password)."' WHERE ID=$user_id ");
誰能幫幫忙?