- Mar 22, 2013
- 8,730
- 10,288
Hey guys,
I did a Yoast SEO update the other day, and it broke a functionality on my Wordpress site where client feedbacks are displayed. If I deactivate Yoast, the problem goes away. The Load More functionality was implemented by a friend, but he's busy now and can't help me. The Load More is done with Ajax from what I understand.
Here are the errors I get when I click the Load More button:
And here is my Load More code from ajax-more.php
Can anyone help?
I did a Yoast SEO update the other day, and it broke a functionality on my Wordpress site where client feedbacks are displayed. If I deactivate Yoast, the problem goes away. The Load More functionality was implemented by a friend, but he's busy now and can't help me. The Load More is done with Ajax from what I understand.
Here are the errors I get when I click the Load More button:
Code:
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home1/rolexz/public_html/MYSITE.com/wp-content/themes/PricerrTheme/ajax-more.php on line 42
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /home1/rolexz/public_html/MYSITE.com/wp-content/themes/PricerrTheme/ajax-more.php on line 43
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home1/rolexz/public_html/MYSITE.com/wp-content/themes/PricerrTheme/ajax-more.php on line 49
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home1/rolexz/public_html/MYSITE.com/wp-content/themes/PricerrTheme/ajax-more.php on line 52
And here is my Load More code from ajax-more.php
Code:
<?php
if(isset($_POST["id"]) && !empty($_POST["id"])){
require( $_SERVER['DOCUMENT_ROOT'].'/wp-load.php' );
function time_elapsed_string($datetime, $full = false) {
$now = new DateTime;
$ago = new DateTime($datetime);
$diff = $now->diff($ago);
$diff->w = floor($diff->d / 7);
$diff->d -= $diff->w * 7;
$string = array(
'y' => 'year',
'm' => 'month',
'w' => 'week',
'd' => 'day',
'h' => 'hour',
'i' => 'minute',
's' => 'second',
);
foreach ($string as $k => &$v) {
if ($diff->$k) {
$v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
} else {
unset($string[$k]);
}
}
if (!$full) $string = array_slice($string, 0, 1);
return $string ? implode(', ', $string) . ' ago' : 'just now';
}
//include database configuration file
include('config.php');
if(is_numeric($_GET["id"]))
{
$pid = $_GET["id"];
}
//count all rows except already displayed
$queryAll = mysqli_query($con,"SELECT COUNT(*) as num_rows FROM wp_job_ratings WHERE orderid < ".$_POST['id']." AND pid=".$pid." AND NOT reason='' ORDER BY id DESC");
$row = mysqli_fetch_assoc($queryAll);
$allRows = $row['num_rows'];
$showLimit = 5;
//get rows query
$query = mysqli_query($con, "SELECT * FROM wp_job_ratings WHERE orderid < ".$_POST['id']." AND pid=".$pid." AND NOT reason='' ORDER BY id DESC LIMIT ".$showLimit);
//number of rows
$rowCount = mysqli_num_rows($query);
if($rowCount > 0){
while($row = mysqli_fetch_assoc($query)){
$tutorial_id = $row["orderid"]; echo '<br>';
$query1 = mysqli_query($con, "SELECT * FROM wp_job_orders where id=".$row['orderid']." ");
while($row1 = mysqli_fetch_assoc($query1))
{
$query2 = mysqli_query($con, "SELECT * FROM wp_users where ID=".$row1['uid']." ");
while($row2 = mysqli_fetch_assoc($query2))
{ $key = 'avatar';
$query3 = "SELECT * FROM wp_usermeta where user_id=".$row1['uid']." AND meta_key = '".$key."'";
$results = mysqli_query($con, $query3);
$numResults = mysqli_num_rows($results);
if ($numResults > 0) { $query4 = mysqli_query($con,"SELECT * FROM wp_usermeta where user_id=".$row1['uid']." AND meta_key = '".$key."'");
while($row3 = mysqli_fetch_assoc($query4))
{ ?> <div class="padd10_only">
<div class="image_holder4">
<img src="<?php echo $row3['meta_value']; ?>" width="25" height="25" /></div>
<?php }
}
else
{ ?>
<div class="padd10_only">
<div class="image_holder4">
<img src="http://MYSITE.com/wp-content/themes/PricerrTheme/images/noav.jpg" width="25" height="25" /></div>
<?php }
?>
<div class="title_holder4" >
<h2><a href="http://MYSITE.com/user-profile/<?php echo $row2['user_login']; ?>"><?php echo $row2['user_login']; ?></a>
<?php }
} ?>
<span class="rating-beeing-done">wrote <?php echo time_elapsed_string('@'.$row['datemade'].''); ?></span></h2>
<div class="c111"><p><?php echo stripslashes ($row ['reason']); ?></p>
</div>
</div>
</div>
<?php ?>
<?php } ?>
<?php if($allRows > $showLimit){ ?>
<div class="show_more_main" id="show_more_main<?php echo $tutorial_id; ?>">
<span id="<?php echo $tutorial_id; ?>" class="show_more" title="Load more posts">Show more</span>
<span class="loding" style="display: none;"><span class="loding_txt">Loading…</span></span>
</div>
<?php } ?>
<?php
}
}
?>
Can anyone help?