have about 300 racks and have been asked with making a SVG out of em all
I noticed that all the racks either have 40,41,42,43,44,45 slots
and also not each rack has the same attributes
I think can us that and create a table
create table racks (
rack_id INT NOT NULL AUTO_INCREMENT,
location VARCHAR(100) NOT NULL,
elevation VARCHAR(100) NOT NULL,
cabinet VARCHAR(100) NOT NULL,
power_panel VARCHAR(100) NOT NULL,
circuit_breaker VARCHAR(100) NOT NULL,
number_of_slots INT NOT NULL,
PRIMARY KEY ( rack_id )
);
to hold all my racks
Then because only certain spaces would be taken up on each rack, can I use his stable to hel the utilized spaces inside each rack?
create table rack_slots (
rack_slot_id INT NOT NULL AUTO_INCREMENT,
rack_id VARCHAR(100) NOT NULL,
slot_number_range INT NOT NULL,
devic VARCHAR(100) NOT NULL,
PRIMARY KEY ( rack_slot_id ),
FOREIGN KEY ( rack_id )
);
then I can use INSERT statements to create the racks and fll the slots up
Then should I us a SELECT query to display all he racks?
I created a different template for the 6 different size of racks which would depend on the number_of_slots record for each record in the racks table.Am I setting this up right?
Well other than that I donāt think a single INT is sufficient to define āslot_number_rangeā, and you should probably spell ādeviceā correctly, sure.
rack_slot_id is technically an unnecessary artificial key (there exists a natural composite key (rack_id,slot_number_range), but its effectiveness is dependant on use case I suppose.
create table racks (
rack_id INT NOT NULL AUTO_INCREMENT,
location VARCHAR(100) NOT NULL,
elevation VARCHAR(100) NULL,
title VARCHAR(100) NOT NULL,
power_panel VARCHAR(100) NOT NULL,
circuit_breaker VARCHAR(100) NOT NULL,
number_of_slots INT NOT NULL,
PRIMARY KEY ( rack_id )
);
create table rack_slots (
rack_id INT NOT NULL,
beginning_slot INT NOT NULL,
ending_slot INT NOT NULL,
device VARCHAR(100) NOT NULL,
FOREIGN KEY ( rack_id )
);
I corrected my typo, got rid of the unnecessary PK, and got rid of the range thing and instead went with a beginning and end value which will be numbers.
I think alls good so can I start populating the tables like
no,the count is only 40-45 so 6 possible values
Im simply trying to create a SVG, which should be an exact copy of http://lukesspot.com/indus_links/templates/45_slot.svg
and place it in a separate directory (I figure Id need to create the file first
$my_new_file = fopen('../racks/cabinet_'.$rack_id.'.svg', "w") or die("Unable to open file!");
Id like to add links inside the new SVG so I can fill some of the slots in the rack
I dont even know how to edit the SVG so I can add links inside using php
I was thinking, can I create (instead of a SVG file, a PHP file
Then edit that, is there a way to save the code outputted in the php file to a SVG file?
Iām sshowing the markup of the file that was createdā¦
Now to add the links, Iāl l use PHP to do this, but how do I add them just after the second
<rect>
(just before all the <text>
Then, how do I save the file to give it a .svg extension? rename()