Robin Jackson wrote:
> We receive registration and payment information, store it in our system, and
> then do the following:
>
> Create a sitegroup record (our memberid and the sitegroup username are the
> same to link the two DB's together.
Sitegroup username?
> insert into sitegroup values (0,'$username','',0)
Which sets sitegroup ID to 0 (not a good idea, I think, since it could
have odd side effects with SG0, the sitegroup name to $username, the
realm to '' (that's probably not an issue), and admingroup to 0 (no
admingroup).
I can't test this because mysql is complaining that the column count
doesn't match the table.
> We take the last_insert_id of the command (which should be sitegroup.id)
Not entirely sure on that. You can assign to autoincrement columns and
they'll take that value. The autoincremet only works (to my knowledge)
if you use a statement with named parameters and omit the
autoincrement column.
> and then create a person record:
>
> insert into person values (0,'$username',$sitegroup_id)
>
> (we get person_num from the last_insert_id info here)
>
> Then we create a Group Record:
>
> insert into grp values (0,'$username','$addr1 $addr2','$zip','$city',
> '','$email','',0,$sitegroup_id)
>
> The above sequence should give us a new Site Group (which we treat as a
> billing entity, the admin group for that company, and the "super user".
>
> What am I missing here?
The admin group is not linked to the sitegroup record. To create a
sitegroup, conceptually:
insert into sitegroup (name,realm) values ($sgname, $realm)
$sg = insert_id
insert into group (name,sitegroup) values ("$sgname rulers", $sg)
$grp = insert_id
insert into person (lastname,firstname,sitegroup) values ($ln, $fn,$sg)
$p = insert_id
insert into member (uid,gid,sitegroup) values ($p, $grp, $sg)
update sitegroup set admingroup=$grp where id=$sg
You could add more fields where you already know their value.
> I notice that there is a group called
> "sitegroup_name administrators" when I create a sitegroup in nadmin. Do I
> have to name my admin group that way?
No.
> Why is namdin showing a "sitegroup_name administrators" group in SG0?
I don't know.
Emile
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]