Re: [PHP] RE: non-auto increment question

2009-03-11 Thread PJ
Ashley Sheridan wrote: > On Thu, 2009-02-26 at 11:27 -0500, PJ wrote: >> Jerry Schwartz wrote: >> Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administr

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Gary W. Smith
> Being rather new to all this, I understood from the MySql manual that > the auto_increment is to b e used immediately after an insertion not > intermittently. My application is for administrators (the site owner & > designates) to update the database from and administration directory, > accessed

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Jerry Schwartz
Sorry, I should know better. >-Original Message- >From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] >Sent: Thursday, February 26, 2009 1:51 PM >To: Jerry Schwartz >Cc: 'PJ'; 'Gary W. Smith'; 'MySql'; php-gene...@lists.php.net >Su

Re: [PHP] RE: non-auto increment question

2009-02-26 Thread PJ
Ashley Sheridan wrote: > On Thu, 2009-02-26 at 13:44 -0500, Jerry Schwartz wrote: > >>> Here's how I mostly do it (albeit simplified): >>> >>> $query = "INSERT INTO `sometable`(`title`,`content`) >>> VALUES('$title','$content')"; >>> $result = mysql_query($query); >>> $autoId = mysql_insert_id($

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Jerry Schwartz
>Here's how I mostly do it (albeit simplified): > >$query = "INSERT INTO `sometable`(`title`,`content`) >VALUES('$title','$content')"; >$result = mysql_query($query); >$autoId = mysql_insert_id($result); > >$query = "INSERT INTO `another_table`(`link_id`,`value`) >VALUES($autoId,'$value'); >$result

RE: [PHP] RE: non-auto increment question

2009-02-26 Thread Jerry Schwartz
>-Original Message- >From: PJ [mailto:af.gour...@videotron.ca] >Sent: Thursday, February 26, 2009 11:27 AM >To: Jerry Schwartz >Cc: a...@ashleysheridan.co.uk; 'Gary W. Smith'; 'MySql'; php- >gene...@lists.php.net >Subject: Re: [PHP] RE: non-auto i

Re: [PHP] RE: non-auto increment question

2009-02-26 Thread PJ
Jerry Schwartz wrote: >> Being rather new to all this, I understood from the MySql manual that >> the auto_increment is to b e used immediately after an insertion not >> intermittently. My application is for administrators (the site owner & >> designates) to update the database from and administra

RE: [PHP] RE: non-auto increment question

2009-02-25 Thread Jerry Schwartz
>Being rather new to all this, I understood from the MySql manual that >the auto_increment is to b e used immediately after an insertion not >intermittently. My application is for administrators (the site owner & >designates) to update the database from and administration directory, >accessed by us

RE: [PHP] RE: non-auto increment question

2009-02-25 Thread Jerry Schwartz
>Being rather new to all this, I understood from the MySql manual that >the auto_increment is to b e used immediately after an insertion not >intermittently. My application is for administrators (the site owner & >designates) to update the database from and administration directory, >accessed by u

Re: [PHP] RE: non-auto increment question

2009-02-25 Thread PJ
Ashley Sheridan wrote: > On Wed, 2009-02-25 at 14:10 -0800, Gary W. Smith wrote: >> Not sure that this is the problem BUT you should probably qualify the >> name of the variable such that "SELECT MAX(id) AS id FROM book". But >> you don't want "max(id) as id" but rather "max(id) + 1 as id". With >>

RE: non-auto increment question

2009-02-25 Thread Gary W. Smith
Not sure that this is the problem BUT you should probably qualify the name of the variable such that "SELECT MAX(id) AS id FROM book". But you don't want "max(id) as id" but rather "max(id) + 1 as id". With that you can then just return the final value. Also, if you don't want to alias the val