473,657 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generic MySQL/PHP Tree Schema?

Folks, any url's around re subject matter? Performance isn't
necessarily a problem, and the depth will be under, say, twenty.

Thanks, all.

--AS

May 14 '07 #1
8 2660
On May 14, 12:52 pm, ashore <shor...@gmail. comwrote:
Folks, any url's around re subject matter? Performance isn't
necessarily a problem, and the depth will be under, say, twenty.

Thanks, all.

--AS
<http://www.google.com/search?q=sql+tr ee+structure>

May 14 '07 #2
ZeldorBlat wrote:
On May 14, 12:52 pm, ashore <shor...@gmail. comwrote:
>Folks, any url's around re subject matter? Performance isn't
necessarily a problem, and the depth will be under, say, twenty.

Thanks, all.

--AS

<http://www.google.com/search?q=sql+tr ee+structure>
If you're looking to create a menu type tree you need to look into
recursion, i use a function like below, not saying this is the best as
I'm a newbie but it work and creates a menu tree, I then use another
function to parse this tree into the format i need (usually html) using
another similar recursing function.

public function makeTree( $menu_seq, $depth ) {

$sql = "SELECT * FROM menu WHERE menu_parent=" . $menu_seq . "
ORDER BY menu_dspseq ASC;";
$ds = mysql_query( $sql ) or die(mysql_error ());
if (mysql_num_rows ($ds)>0) {
while ( $dr = mysql_fetch_ass oc($ds) ) {
$sql = "SELECT COUNT(menu_seq) FROM menu WHERE
menu_parent = " . $dr['menu_seq'];
$dsc = mysql_query($sq l);
$drc = mysql_fetch_arr ay($dsc);
$array[$dr['menu_seq']]['menu_text'] =
htmlentities($d r['menu_text']);
$array[$dr['menu_seq']]['menu_parent'] =
$dr['menu_parent'];
$array[$dr['menu_seq']]['menu_page'] =
$dr['menu_page'];
$array[$dr['menu_seq']]['depth'] = $depth;
if ($drc>0) {
$array[$dr['menu_seq']]['children'] =
$this->makeTree( $dr['menu_seq'], $depth+5 );
} else {
$array[$dr['menu_seq']]['children'] = null;
}
}
mysql_free_resu lt($ds);
}
return (isset($array) ? $array : false);

}
May 16 '07 #3
Thanks, all - yr responses are appreciated.

Now, answering my own posting in case others are following this
thread: Do take a look at

http://freshmeat.net/projects/nodetree/

Pretty good, actually.

-AS

May 19 '07 #4
>
If you're looking to create a menu type tree you need to look into
recursion, i use a function like below, not saying this is the best as
I'm a newbie but it work and creates a menu tree, I then use another
function to parse this tree into the format i need (usually html) using
another similar recursing function.

I think if you're going to have any kind of volume and depth at all,
it's probably better to stay away from recursive solutions, since you
could end up with an awful lot of queries per page load. Of course,
you could use caching or something to minimize this, but... I like
outline style solutions, where you keep all your data in one table and
have one column that keeps some data outline style ("1.12.5" or
similar) It looks like that nodetree project uses soemthing like
this...

Aerik

May 20 '07 #5
The application area I have in mind here is a crisis management/
tracking/dispatch operation, in which there's a hierarchy of component
steps comprising the collection of responses. (Ex: a storm, in which
roads, bridges, waterways, telecommunicati ons facilities, hospitals,
etc., are affected, with distinct problems associated with each.)

Kind of like a work breakdown structure, but somewhat more dynamic. I
looked at some project management applications, but a cursory scan
showed nothing like what we're discussing here -- although I can't
imagine we're breaking new ground.

-AS

May 20 '07 #6
ashore wrote:
The application area I have in mind here is a crisis management/
tracking/dispatch operation, in which there's a hierarchy of component
steps comprising the collection of responses. (Ex: a storm, in which
roads, bridges, waterways, telecommunicati ons facilities, hospitals,
etc., are affected, with distinct problems associated with each.)

Kind of like a work breakdown structure, but somewhat more dynamic. I
looked at some project management applications, but a cursory scan
showed nothing like what we're discussing here -- although I can't
imagine we're breaking new ground.
It's ancient technology, but look at MUMPS, the Massachusetts
General Hospital system from the 1970s.

John Nagle
May 21 '07 #7
On 14 Mai, 18:52, ashore <shor...@gmail. comwrote:
Folks, any url's around re subject matter? Performance isn't
necessarily a problem, and the depth will be under, say, twenty.

Thanks, all.

--AS
Look at this: "Managing Hierarchical Data in MySQL" (
http://dev.mysql.com/tech-resources/...ical-data.html )

May 21 '07 #8
Perfect! Thanks,

-AS

On May 21, 6:50 am, maruerru <m...@mrumpf.de wrote:
>
Look at this: "Managing Hierarchical Data in MySQL" (http://dev.mysql.com/tech-resources/...ical-data.html)

May 21 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
9635
by: Fu Bo Xia | last post by:
anyone know a Java (or Java usable) package that converts XML Schema (XSD) documents into a tree form? thanks, fu bo
0
654
by: Morten Gulbrandsen | last post by:
Hi programmers, I try to investigate some of the basics behind schemas and cataloges, Which is part of SQL2 Language this is the error message I get:
1
3861
by: Ben | last post by:
Due to my unfamiliarity with schemas, I am unable to figure out how to accomplish the same type of processing that I have currently working under a dtd. We have a pre-defined generic message header that must appear on all XML messages in our shop. We have several processes that just need to process the generic header to determine how to route the message and which service needs to process the message. So we have an XML structure that at...
1
2226
by: Novitas | last post by:
I would like to perform a schema validation of a DOM tree that is already assembled in memory with as little fuss and setup as possible. I see support in the Xerces documentation to perform validation with DOMBuilder and XercesDOMParser. There is also an interface class called XMLValidator, but it is not clear to me how I might use these resources to achieve what I described above. Any help getting started in the right direction would...
2
1192
by: Wilhelm Pieper | last post by:
Hello, HowTo: create a more generic schema for tree-style objects. (Generic in the sense of unknown depth). eg: <root> <node> <node> .. <leaf>..</leaf> .. </node>
57
25503
by: Bing Wu | last post by:
Hi all, I am running a database containing large datasets: frames: 20 thousand rows, coordinates: 170 million row. The database has been implemented with: IBM DB2 v8.1
4
4930
by: Mitchel Haas | last post by:
Hello, Feeling a need for a generic tree container to supplement the available containers in the STL, I've created a generic tree container library (TCL). The library usage is very much like the containers in the STL, including iterator usage. Info on the library can be found here.. http://www.visuallandlord.com/developers_corner/open_source/tree_container_library/overview.php The library and sample code can be downloaded from this...
3
5981
by: h4xPace | last post by:
I am building a MySQL query application, and I have run into a small snag. MySQL has released a set of classes that extend the .NET framework base data classes (command, connection, etc), and I am using them to interact with the MySQL server (on localhost). Everything works great on that side of the aisle. However, I have never worked with getting schema from a database before, so I am fumbling around for a workable solution to doing...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.