Reply to Re: mysql_insert_id ()

Your name:

Reply:


Posted by J.O. Aho on 11/19/06 06:52

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация