Biju
03-03-2008, 11:20 AM
Friends,
I was just doing some coding in PHP, i am struck in a part. Can anyone state me whats the problem....
<?php
$category = get_the_category();
$recent = new WP_Query("cat='echo $category[0]->cat_ID;'&showposts=1"); while($recent->have_posts()) : $recent->the_post();
?>
I want to show one post from the particular category if visited. This particular code works but displays the recent post.
If i place cat = 43 or something it works perfectly. My Question is
Why is echo $category[0]->cat_ID; not printing out the ID number dynamically based on the category.
Note : I am not a PHP programmer. I am a JAVA. :D
Regards
I was just doing some coding in PHP, i am struck in a part. Can anyone state me whats the problem....
<?php
$category = get_the_category();
$recent = new WP_Query("cat='echo $category[0]->cat_ID;'&showposts=1"); while($recent->have_posts()) : $recent->the_post();
?>
I want to show one post from the particular category if visited. This particular code works but displays the recent post.
If i place cat = 43 or something it works perfectly. My Question is
Why is echo $category[0]->cat_ID; not printing out the ID number dynamically based on the category.
Note : I am not a PHP programmer. I am a JAVA. :D
Regards
