|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
treeview of Mysql table
Can anobody tell me how to output a treeview of MySQL table. I mean the displyed graph should look like windows explorer way of displaying directory files.
Thanx Last edited by mylibya : March 19th, 2003 at 04:59 AM. |
|
#2
|
|||
|
|||
|
Hi,
First, go here and grab this nice javascript tree menu from this site: www.destroydrop.com/javascripts/tree/ Then use my little example below as a guide ![]() PHP Code:
If you need some more help post here or mail me. Regards Tylendel Last edited by tylendel98 : March 20th, 2003 at 01:42 PM. |
|
#3
|
|||
|
|||
|
wow thanks alot this is exactly what i needed and its very easy to implement
![]() |
|
#4
|
|||
|
|||
|
Hi,
Glad it was of some assistance. Regards Tylendel |
|
#5
|
||||
|
||||
|
Is there a functioning example of this?
I wouldn't mind seeing what the code's output looks like. |
|
#6
|
|||
|
|||
|
Hi,
DarkMedia have been kind enought to put up a basic working example here: http://www.dark-media.net/intel/dtree_mysql.php Cheers Tylendel |
|
#7
|
||||
|
||||
|
|
|
#8
|
|||
|
|||
|
Hi MadCowDzz,
Your very welcome I cannot take credit for the actual core dtree javascript only the mysql implementation! Cheers Tylendel |
|
#9
|
|||
|
|||
|
Quote:
can you email me all examples of your .sql, .php, .js. ? my email : webbisnis@yahoo.com (you know that i'm so hard to understand) |
|
#10
|
|||
|
|||
|
Another attempt
Tylendel,
Thanks for your sample code. I was not able to get it to work properly and found a very similar appraoch at: URL I don't know what I was doing wrong using your example, but considering the post is a few years old, maybe it is a version issue of some type. Anyway, the code I used was: Code:
<?php
/* Begin code: */
/* My database connection include file */
require_once('../Connections/docmgr.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Document Manager</title>
<link rel="StyleSheet" href="dtree.css" type="text/css" />
<script type="text/javascript" src="dtree.js"></script>
</head>
<body>
<div class="dtree">
<p><a href="javascript: d.openAll();">open all</a> | <a href="javascript: d.closeAll();">close all</a></p>
<script type="text/javascript">
<!--
d = new dTree('d');
d.add(0,-1,'Your Documents');
<?php
/* Variables from my database include file */
mysql_select_db($database_docmgr, $docmgr);
$query = "SELECT folderid, parentid, title, name FROM folders ORDER BY folderid";
$result = mysql_query($query, $docmgr) or die ("Fail Query");
while ($row = mysql_fetch_array($result)) {
extract($row);
echo("
d.add($folderid,$parentid,'$title','test.html');
");
}
?>
document.write(d);
//-->
</script>
</div>
</body>
</html>
<?php mysql_free_result($result);
/* End Code */
?>
|
|
#11
|
|||
|
|||
|
Thanks For your Code But i have a Problem
I have coppied your code and manupulated for my local server apache with mysql
my databse looks like this | userid | refid | name | 1001 9000 ABC 1002 1001 BTG 1003 1001 SAD 1004 1002 SDS 1005 1002 RGS 1006 1001 WER 1007 1002 WEW And so on I want to display all the childs acorrdingly what should i have to change in this sctript so that it would work Thanks in advance |
|
#12
|
|||
|
|||
|
Treeview: very confused about data structure
Hi all!
Im migrating an MSSQL app to php / mysql and I have to deal with the way the data in MSSQL had been setup. One of the tables has only two columns: objpatid and Localizacion. objpatid is an indexed integer identification number unique for each object in the database. Localizacion is the column for every object, its data structured more like a "path" to a physical location in a builduing, a typical row in that column looks like this: 2ND FLOOR \ GENERAL INTENSIVE CARE UNIT \ INTENSIVE CARE UNIT ROOM ONE \ DEFIBRILLATOR 2ND FLOOR \ GENERAL INTENSIVE CARE UNIT \ INTENSIVE CARE UNIT ROOM ONE \ NEGATOSCOPE I would like to display this in the web page as a treeview, where you have, for example, the floors, 1ST FLOOR, 2ND FLOOR, etc., then as you open 2ND FLOOR it shows the areas in second floor, let's say: GENERAL INTENSIVE CARE UNIT, etc., when you expand that area then shows ... etc.,.... The data is delimited by the " \ " (backslash). Please, help me understand this or how can I organize this to be able to present it as a treeview. Thanks! ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > treeview of Mysql table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|