This is the error I am getting:
[You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
I don't get the error. I can't find it.
This is my code:
function my_bp_adminbar_notifications_menu() {
global $bp;
if ( !is_user_logged_in() )
return false;
echo '<li id="top-notification">';
_e( 'Alerts', 'buddypress' );
if ( $notifications = bp_notifications_get_notifications_for_user( $bp->loggedin_user->id ) ) { ?>
<span><?php echo count( $notifications ) ?></span>
<?php
}
if ( $notifications ) {
$counter = 0;
for ( $i = 0; $i < count($notifications); $i++ ) {
$alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
<li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
<?php $counter++;
}
} else { ?>
What is going on here? I do not see a single quote that could be faulty.
bp_notifications_get_notifications_for_user()look like? It could be the cause. This error message is usually produced by an incomplete query (f.e., the query contains aWHEREclause but no conditions).