Hi.
I'm trying to use a mysql query for showing some entries related to a category. First, I've sent the category_id using a form and get method in a file named compare.php !!!
In a new file named step2.php, I wanted to show the names of all the entries related to chosen category.
So, the code I have used, is this :
$category = (int)$_GET['category_id'];
$query = mysql_query ("SELECT * FROM mt_entry where `entry_category_id`=$category")or die(mysql_error());
Unfortunately, there is no Category ID in entry_category_id and all of results are NULL !
Can somebody help me to write this query ?! I would really appreciate it.
Reported on Movable Type 5

Replace your query with the following:
$query = mysql_query ("SELECT * FROM mt_entry, mt_placement, mt_entry WHERE (placement_category_id = category_id) AND (placement_entry_id = entry_id) AND (category_blog_id = $category) AND (entry_status = 2) ORDER BY entry_created_on DESC LIMIT 5")or die(mysql_error());
This query would list for you the latest 5 entries that are published (not also the draft posts, or the ones scheduled to be published later).
You could change the ordering criteria or the number of posts displayed, playing with:
ORDER BY entry_created_on DESC LIMIT 5
Kind Regards,
Mihai Bocsaru
----------------------------------
Daily Movable Type Consultant
Web Development
Movable Type Consulting
Six Apart Partner
http://www.pro-it-service.com/
----------------------------------
Movable Type Demo
http://www.movabletypedemo.org/
----------------------------------
Open Melody Demo
http://www.openmelodydemo.org/