arunpatal Posted November 28, 2013 Author Share Posted November 28, 2013 Then don't use CONCATE_GROUP(). What should i use instead of CONCATE_GROUP()? Quote Link to comment Share on other sites More sharing options...
Barand Posted November 28, 2013 Share Posted November 28, 2013 Throw away my query - it won't work for what you are trying to do. What does "$datatb" contain in your links where you have "&datatb=$datatb"? Quote Link to comment Share on other sites More sharing options...
arunpatal Posted November 28, 2013 Author Share Posted November 28, 2013 Throw away my query - it won't work for what you are trying to do. What does "$datatb" contain in your links where you have "&datatb=$datatb"? $datatb is a topic table.... id int auto_increment primary key, topic_title mediumtext, topic_detail mediumtext, added_date date, sub_id int(11) This is where sub_cat_id from subcategory table is saved and my subcategory table is like this sub_cat_id int auto_increment primary key, sub_cat_name varchar(500), category_id int(11) Quote Link to comment Share on other sites More sharing options...
Barand Posted November 28, 2013 Share Posted November 28, 2013 I assume the <div>s have a float:left style. Try $datatb = 'datatb'; $sql = "SELECT s.sub_cat_id, s.sub_cat_name, t.id, t.topic_title FROM ( SELECT sub_cat_id, sub_cat_name FROM subcategory ORDER BY sub_cat_id DESC LIMIT 5 ) as s INNER JOIN $datatb t ON (s.sub_cat_id=t.sub_id) ORDER BY s.sub_cat_id DESC , t.id DESC"; $res = mysql_query($sql); $prev = ''; while ($row = mysql_fetch_assoc($res)) { if ($prev != $row['sub_cat_id']) { // has sub_cat changed? echo "{$row['sub_cat_name']}<br>"; $prev = $row['sub_cat_id']; } echo "<div class='topic_list' id='topic_list{$row['id']}'> <a href='review.php?topic_id={$row['id']}&datatb=$datatb'>"; echo strtoupper($row['topic_title']); echo "</a></div>"; } Quote Link to comment Share on other sites More sharing options...
Solution arunpatal Posted November 28, 2013 Author Solution Share Posted November 28, 2013 I assume the <div>s have a float:left style. Try $datatb = 'datatb'; $sql = "SELECT s.sub_cat_id, s.sub_cat_name, t.id, t.topic_title FROM ( SELECT sub_cat_id, sub_cat_name FROM subcategory ORDER BY sub_cat_id DESC LIMIT 5 ) as s INNER JOIN $datatb t ON (s.sub_cat_id=t.sub_id) ORDER BY s.sub_cat_id DESC , t.id DESC"; $res = mysql_query($sql); $prev = ''; while ($row = mysql_fetch_assoc($res)) { if ($prev != $row['sub_cat_id']) { // has sub_cat changed? echo "{$row['sub_cat_name']}<br>"; $prev = $row['sub_cat_id']; } echo "<div class='topic_list' id='topic_list{$row['id']}'> <a href='review.php?topic_id={$row['id']}&datatb=$datatb'>"; echo strtoupper($row['topic_title']); echo "</a></div>"; } First of all thanks that you came back and helped....... Next time i will make sure that i can provide maximum and clear information. Now the good thing This works...... now showing exactly the way i want... Many thanks to Barand & Jazzman1 Quote Link to comment 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.