|
Posted by linda on 11/20/06 21:17
"J.O. Aho" <user@example.net> wrote in message
news:4sad9jFulq1tU1@mid.individual.net...
> linda wrote:
>> "linda" <n0spamF0rme@tiscali.co.uk> wrote in message
>
>> Ok I can't figure out why this wont work! When i try to pull the id from
>> the last insert and place it into a variable to use in the Permissions
>> table, it doesn't add it. I thought that maybe I couldn't pass it in a
>> variable but when I error check it with an if statement it does.
>
> Looking at your code at this hour, seems to be okey, the only thing that
> may cause problems is if you have chosen to use BIGINT as the type in your
> User_Reg.user_id column or if you set AUTO_INCREMENT for the
> Permissions.user_id.
>
> The BIGINT-problem causes you to get wrong value for mysql_insert_id()
>
> The AUTO_INCREMENT-problem in Permissions table causes the INSERT to fail.
>
>
> In this case I think the problem lies that you have included
> AUTO_INCREMENT to your Permissions tables user_id column.
>
>
> Side note:
> > $query_insert_id= "INSERT INTO Permissions (user_id) VALUES
> > ('$last_id')";
>
> Looking at this INSERT query, it really don't seem to be any new
> information in your Permissions table, just storing the user_id won't make
> it much useful, then it would be better to have an extra column in your
> User_Reg, will take less space on your hard drive.
>
>
> //Aho
Hi Aho,
And thanks again for your reply, I've got it working now. I re-wrote the
code and it started working, so I guess I will never know what the problem
was. Very odd...
As for the permissions table, yep your right. After thinking about this
table with a good nights sleep behind me, I realised I was going about it
the wrong way. I know revamped the two tables, the permissions table store's
page_id, permission_lvl, and page. I then link the two with the
permission_lvl.
Thank you once again for your help and VERY useful opinions.
Best wishes,
Linda
[Back to original message]
|