Sorting Doesn't work after using %s on query
-
Hello,
I am currently building a plugin that allows to add images to a comment. I have created a table for comments with images in the admin panel with sorting. Since adding %s and on prepare it no longer sorts.WP 3.4
SELECT * FROM $wpdb->comments, $wpdb->commentmeta WHERE $wpdb->comments.comment_ID = $wpdb->commentmeta.comment_ID ORDER BY $orderby $orderwould result in this query:
SELECT * FROM sanap_comments, sanap_commentmeta WHERE sanap_comments.comment_ID = sanap_commentmeta.comment_ID ORDER BY comment_post_ID descWP 3.5
SELECT * FROM $wpdb->comments, $wpdb->commentmeta WHERE $wpdb->comments.comment_ID = $wpdb->commentmeta.comment_ID ORDER BY %s %sResults in:
SELECT * FROM sanap_comments, sanap_commentmeta WHERE sanap_comments.comment_ID = sanap_commentmeta.comment_ID ORDER BY ‘comment_post_ID’ ‘asc’Anyone know what I need to change to make it work with the $wpdb->prepare()?
- The topic ‘Sorting Doesn't work after using %s on query’ is closed to new replies.