Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

SQL INSERT

Quote Reply
SQL INSERT
In admin.cgi -> sub alternate_categories there is:

$db->do ("INSERT INTO CategoryAlternates (LinkID, CategoryID) VALUES($id, $add_to)");

But the table is defined:

CategoryID | LinkID


So it seems it is not important in which order i do my INSERT?
Or is it need from end to begin?

Could i do something like:

INSERT INTO gaga (ROW3, ROW1, ROW2) VALUES (value3, value1, value2)
or
INSERT INTO gaga (ROW1, ROW3, ROW2) VALUES (value1, value3, value2)
or ...

So this would mean it is only important to hold the order right for
(ROWs(Values)).

???
Robert

Quote Reply
Re: SQL INSERT In reply to
I think you are looking at it correctly.

In an insert, the data is imported in the order given. Each "key" in the list has a corresponding element in the "value" list.

(key1, key2, key3)

Needs to have a value:

(value1, value2, value3)

Defined.

These are considered "lists" and the first item in each is paired, the second item in each is paired, etc.

This is how you can INSERT into a database, without knowing the order the database fields are in. As long as there is key/value pair in the insert, the database will insert "value" into key-"field".



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: SQL INSERT In reply to
Yes, so it is :-)
Now i have done it; a new table "Access" and one for "AccessAlternates";
with a lot of work in admin.cgi, html_admin and db_utils, i have no a solution for my access-area-needs;
the same like cats and alternate cats, i can now set one main-access-area with the add-form (as hidden field from the cat) and inside the area people could choose further areas ... so i must still do it manually like the alternate cats,
but this is the best solution at the moment and i have solved the problem to need n values for 1 field :-)

Robert (Im afraid the new version will come just one hour after i have finished my work :-)

Quote Reply
Re: SQL INSERT In reply to
Alex is promising a beta-review program by friday, with the final version a few weeks later.

you might not want to move your site over to the new version on Friday, but it should help guide you to where you development is going.

I can't wait! I've been wanting/needing to see the new logic for so long now, I may not know what to do when it finally gets here :)

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/