I don’t believe you can use query_posts()
for that (mutliple posts), but I’m not sure.
Just use this instead:
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID='21' OR ID='43'");
Thread Starter
gs06
(@gs06)
Thanks
tried, but got jibrish
i used the code as follows:
<?php get_header(); ?>
<?php get_sidebar(); ?>
<?php
$posts = $wpdb->get_results(“SELECT * FROM $wpdb->posts WHERE ID=’21’ OR ID=’43′”);
?>
this is not on my index page but home.php
what am i doing wrong ?
Thread Starter
gs06
(@gs06)
yea exactlly
got jibrish as well
how do i incoperate your code
to my home.php page ?
He means what was the jibrish exactly?
Thread Starter
gs06
(@gs06)
the 2 posts are there but then
i get a bunch of strange error-posts :
Category: Uncategorized
WordPress database error: [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 comment_approved = ‘1” at line 1]
SELECT COUNT(comment_ID) FROM wp_comments WHERE comment_post_ID = AND comment_approved = ‘1’;
0 Comments
, Edit This
Category: Uncategorized
WordPress database error: [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 comment_approved = ‘1” at line 1]
SELECT COUNT(comment_ID) FROM wp_comments WHERE comment_post_ID = AND comment_approved = ‘1’;
0 Comments
, Edit This
Category: Uncategorized
WordPress database error: [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 comment_approved = ‘1” at line 1]
SELECT COUNT(comment_ID) FROM wp_comments WHERE comment_post_ID = AND comment_approved = ‘1’;
0 Comments
, Edit This
Category: Uncategorized
WordPress database error: [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 comment_approved = ‘1” at line 1]
SELECT COUNT(comment_ID) FROM wp_comments WHERE comment_post_ID = AND comment_approved = ‘1’;
Please post the contents of your entire home.php or whatever: http://pastecode.com
Thread Starter
gs06
(@gs06)
You need to add the code as I mentioned above. π
http://pastecode.com/4030
Thread Starter
gs06
(@gs06)
Thanks Viper007Bond.
i tried it
but this line >>
<?php else : ?>
keeps coming as error > > parse error, unexpected $
i tried to delete the line
no good
tried to delete
<?php else : ?>
<?php _e(‘Sorry, no posts matched your criteria.’); ?>
<?php endif ?>
no good
suggestions ?
I had this very same problem … it was fixed very easily … i went through disabling all my plugins one by one .. the 3rd plugin i disabled fixed it .. it was my Adhesive plugin that was messing it up.
http://www.redalt.com/downloads/ was where it was from .. and now doesn’t seem to be kept up to date .. so if i need sticky posts i won’t be using it any more !
I have the same error on the index page at http://www.amyloo.com/clipoftheweek
Like one of the first posters in this thread, it happened after I added a query_post — in my case to exclude a particular category of posts from the index.
Like the just-previous poster, I isolated the troublemaker. It’s the theme; when I revert to the basic theme, the error goes away. Problem is the thememaker says my question is beyond his scope of support http://forums.wpthemes.info/comments.php?DiscussionID=126/
So now what? I’ll likely end up starting over with a new theme based on the default rather than modifying a theme that doesn’t look anything like what I ended up with anyway! But for a quick fix, I thought it might be worth asking if anybody has any ideas. Thanks.
/amyloo