SourceTec Software

It is currently Fri Apr 18, 2014 6:23 am

All times are UTC + 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Create ordered list
PostPosted: Tue Mar 17, 2009 8:34 am 
Offline
Member

Joined: Tue Mar 17, 2009 8:26 am
Posts: 2
Hi Im new to the tree list software and I have a question that I can seem to find an answer to...

Im trying to create a tree list from a mysql db. This I can do and the code works well javascript:emoticon(':wink:'). I want to make the sub nodes list in alphabetical or numerical order. I have tried adding an ORDER BY statement but this stops treelist from working... Below is the code / SQL statemtn I am using.

/*
<?php
$n2_tbl= mysql_query("SELECT * FROM n2_tbl WHERE node1_id=".$r_n1_tbl["id_node1"] );
while($r_n2_tbl=mysql_fetch_array($n2_tbl))
{
$sNode2_Name = $r_n2_tbl["node2_name"];
$sLink = $r_n2_tbl["id_node2"];
?>
*/

How can I make the above code display an ordered list alphabetical or numerical. Any help much appreciated
:o :cry:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 18, 2009 1:37 pm 
Offline
Guru

Joined: Wed Jan 31, 2007 4:21 am
Posts: 1116
mysql_query("SELECT * FROM n2_tbl WHERE node1_id=".$r_n1_tbl['id_node1']." ORDER BY whatever");


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 18, 2009 8:28 pm 
Offline
Member

Joined: Tue Mar 17, 2009 8:26 am
Posts: 2
Hi The Username,

Thanks for taking the time to reply (its much appreciated). I have tried your suggestion and when I run that code the page displays the top level nodes (as this is done via a different query) but does not show the lower nodes (its as if the 2nd query returns zero results when it has the ORDER BY statement in it)

Query with your suggestion added in..

/*
<?php
$n2_tbl= mysql_query("SELECT * FROM n2_tbl WHERE node1_id=".$r_n1_tbl["id_node1"]."ORDER BY n2_tbl.node2_name");
while($r_n2_tbl=mysql_fetch_array($n2_tbl))
{
$sNode2_Name = $r_n2_tbl["node2_name"];
$sLink = $r_n2_tbl["id_node2"];
?>
*/

very strange.. Im sure there is a small think im missing but so far I have not got a solution. If you or anyone else has another idea if would be appreciated.

Thx


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 8 hours


Who is online

Users browsing this forum: Exabot [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group