dmarchman Posted May 22, 2005 Share Posted May 22, 2005 What I'm trying to do is create an entry page for my blog that will display my blog entries. To give you an example of what is going to be displayed, here is the layout: Recent blog header Most recent title date posted tagline blog entry body copy Previous blog entries header Blog title Blog title Blog title I basically want the most recent entry in my blog database to display in its entirety, then below that show the next 3 recent entries in the database as a title only. This is the query I use to display the most recent entry: SELECT * FROM blogent INNER JOIN topics ON idtop_blogent = id_top ORDER BY id_blogent DESC LIMIT 1 And with the help of a friend (who knows nothing about PHP but knows ColdFusion so I took the code he gave me and did my best to translate it) I wrote this query to try to display the other entries: SELECT * FROM blogent INNER JOIN topics ON idtop_blogent = id_top WHERE id_blogent <> '$query_rsBlog' ORDER BY id_blogent DESC the $query_rsBlog is the variable name the query is being stored in. it's a recordset built w/ Dreamweaver since I'm not comfortable with hand writing my SQL. Here is the full code for the recordsets that Dreamweaver writes if it helps.. [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]mysql_select_db($database_heading1, $heading1); $query_rsBlog = \"SELECT * FROM blogent INNER JOIN topics ON idtop_blogent = id_top ORDER BY id_blogent DESC LIMIT 1\"; $rsBlog = mysql_query($query_rsBlog, $heading1) or die(mysql_error()); $row_rsBlog = mysql_fetch_assoc($rsBlog); $totalRows_rsBlog = mysql_num_rows($rsBlog); mysql_select_db($database_heading1, $heading1); $query_rsOtherBlogs = \"SELECT * FROM blogent INNER JOIN topics ON idtop_blogent = id_top WHERE id_blogent <> \'$query_rsBlog\' ORDER BY id_blogent DESC\"; $rsOtherBlogs = mysql_query($query_rsOtherBlogs, $heading1) or die(mysql_error()); $row_rsOtherBlogs = mysql_fetch_assoc($rsOtherBlogs); $totalRows_rsOtherBlogs = mysql_num_rows($rsOtherBlogs);[/span][!--PHP-Foot--][/div][!--PHP-EFoot--] If anyone could educate me on this I would appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/2319-displaying-recordset-data/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.