Drawing lines between pairs

Is there a way i can draw lines in php to match pairs?

The result i want is like http://www.cauwenbergh.be/verzamel.jpg

I get the information from a database (mysql) in tables, some of them are pairs and i want to connect them by lines, so suggestions are welcome!

The GD Library allows you to write text, and draw shapes in an image. So potentially you could write the text data down the image, keeping track of the coordinates of each line, or piece of data in an array as you go. Then when you find relationships between data you’d look up those coordinates to draw a line between them. I’m thinking here of two vertical columns, rather than the vertical/horizontal in your example.

Knowing where the right edge of the left column is could be difficult. If there’s little variation in line length it mightn’t matter.

the horizontal -> vertical is because it is to make rackunits and switchports visual and connect them