Hi all,
I'm by no means an expert in SQL and have a query that's causing an error in my logs. The error is:
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 'AND user_gifts.status = 1 AND gifts.ID != 26 AND gifts.ID != 114 AND gifts.ID !=' at line 1 for query SET NAMES 'utf8' made by require, require_once, include, get_user_gifts
The query I think it refers to is:
$q = 'SELECT *, (SELECT COUNT(*) FROM '.$wpdb->prefix.'user_gifts u_gifts WHERE u_gifts.gift_ID = user_gifts.gift_ID) as `count` FROM '.$wpdb->prefix.'user_gifts user_gifts INNER JOIN '.$wpdb->prefix.'gifts gifts ON gifts.ID = user_gifts.gift_ID WHERE user_gifts.user_ID = '.$user_ID.' AND user_gifts.status = 1 AND gifts.ID != '.$candle_db_id.' AND gifts.ID != '.$music_db_id.' AND gifts.ID != '.$user_defined_memorial_image.' '.( $group_by ? 'GROUP BY '.$group_by : '' ).'';
Has anyone any idea what is wrong with this query??
Thanks for any light you can shed on this.
;-)
Spend a few minutes remembering your loved ones,
Create a permanent memorial to commemorate their life,
I'm by no means an expert in SQL and have a query that's causing an error in my logs. The error is:
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 'AND user_gifts.status = 1 AND gifts.ID != 26 AND gifts.ID != 114 AND gifts.ID !=' at line 1 for query SET NAMES 'utf8' made by require, require_once, include, get_user_gifts
The query I think it refers to is:
$q = 'SELECT *, (SELECT COUNT(*) FROM '.$wpdb->prefix.'user_gifts u_gifts WHERE u_gifts.gift_ID = user_gifts.gift_ID) as `count` FROM '.$wpdb->prefix.'user_gifts user_gifts INNER JOIN '.$wpdb->prefix.'gifts gifts ON gifts.ID = user_gifts.gift_ID WHERE user_gifts.user_ID = '.$user_ID.' AND user_gifts.status = 1 AND gifts.ID != '.$candle_db_id.' AND gifts.ID != '.$music_db_id.' AND gifts.ID != '.$user_defined_memorial_image.' '.( $group_by ? 'GROUP BY '.$group_by : '' ).'';
Has anyone any idea what is wrong with this query??
Thanks for any light you can shed on this.
;-)
Spend a few minutes remembering your loved ones,
Create a permanent memorial to commemorate their life,