I have a DB table with records that have connection to one another. sort of like object a comes before b, and object c comes after c. table1- Id, pre, post
I have all the connections in the DB, what I'm trying to do is to make some sort of way to show all the connections on the page, in a graphical and simple way.

the results should look something like this, but they don't have to, as long as it's clearly shown in any other form.


so I was thinking generating a picture, but have no idea where to start with this..
I can make something in html using divs but the problem here is how to connect the divs in a visual way that is simple yet undertandable..

any advice would be highly appreciated :)

I think you can use gd libraries. You can draw rectangles and lines using it using php code. gd must be installed on your server with php.

I have been having this same problem these days. This is how I intend to go about it. if you do it this way, let me know how it turns out:

I am assuming you have a tree (or multiple trees). determine the greatest depth of the tree/trees. build a mental column (use divs) for ever depth level. the deepest nodes, put them on the rightmost div. the least deepest, on the leftmost div. hope this helps.

bibiki, if your db structure is like tree, the you may can create tree kind of structure using javascript-php, so many such scripts are available on net.

I wouldn't want to highjack the OP's post. however, I'll have your advice in mind when I get to that part of my project. thanks a lot. otherwise, I am just building the first project in PHP, so I more than welcome advice. thank you!

mm I checked out this GD Library and though it sounds very cool I still can't see how this helps me. the main problem is not how to create the boxes with the words, it's how to connect the boxes. GD has functions that draw lines..but I don't see how I can automaticly make 2 boxes connect, and even if I can, still there are so many connections that ,the lines are gonna go on top or behind the boxes and I'm afraid it's gonna look aweful and unclear.

any other suggestions?

bibiki I have no idea what u meant lol, I don't really think it's a tree what I'm dealing with here..

gd library can not connect the boxes, you are going to build logic for it. You must know the position and width of boxex, you can write text using gd. just you have to work with coordinatest, so roughly on paper graph draw your design and create images using php gd function.