RE: [PHP-DB] getting ID

From: Date: Mon, 20 Aug 2001 10:32:02 +0000
Subject: RE: [PHP-DB] getting ID
Groups: php.db 
Request: Send a blank email to php-db+get-11541@lists.php.net to get a copy of this message
Yap ... this works quite fine with Sybase .... Thank you very much ... > -----Original Message----- > From: tony.mccrory@mgn.co.uk [SMTP:tony.mccrory@mgn.co.uk] > Sent: Monday, August 20, 2001 12:27 > To: Walter, Marcel > Cc: php-db@lists.php.net > Subject: RE: [PHP-DB] getting ID > > > With MSSQL I do: > > $result=mssql_query("select @@IDENTITY as 'jobNumber'"); > $row=mssql_fetch_array($result); > $insertid=$row[jobNumber]; > > May be similar for sybase.. I understand they have similar origins.. > > Tony > > > > > > "Walter, > > Marcel" To: 'Ian Grant' > <ian.grant@btinternet.com>, php-db@lists.php.net > <Marcel.Walter cc: > > @drkw.com> Subject: RE: [PHP-DB] > getting ID > > > 08/20/2001 > > 11:22 AM > > > > > > > > > > Is there a similar function for a Sybase - Database ? > > > -----Original Message----- > > From: Ian Grant [SMTP:ian.grant@btinternet.com] > > Sent: Monday, August 20, 2001 12:20 > > To: php-db@lists.php.net > > Subject: Re: [PHP-DB] getting ID > > > > mysql_insert_id([resource link_identifier]) returns the value of the > > auto_increment field for the previous INSERT query. It will return 0 if > > there is not an auto_increment field. If the link_identifier is not > > specified, the last opened connection is used. > > > > So, use $id = mysql_insert_id(); directly after your $result = > > mysql_query($query); operation (where $query is an INSERT query) to pull > > the > > id value you have just auto inserted back out. > > > > > > Ian. > > > > Manual page: > > http://www.php.net/manual/en/function.mysql-insert-id.php > > Crosswalkcentral <support@crosswalkcentral.net> wrote in message > > news:20010819185855.60275.qmail@pb1.pair.com... > > > I tried this and it gave me an error. > > > > > > Will this > > > > > > $id = mysql_insert_id(); > > > > > > allow me to pull out the id? > > > > > > > > > -- > > > Cross Walk Central > > > www.crosswalkcentral.net > > > Support Center > > > Your Web Hosting Community! > > > > > > "Cynic" <cynic@mail.cz> wrote in message > > > news:5.1.0.14.2.20010819203852.00b4d260@mail.cz... > > > > At 19:19 8/19/2001, CrossWalkCentral wrote the following: > > > > -------------------------------------------------------------- > > > > >I have a script where I submit user data to the database in my > script > > I > > > need > > > > >to get the id # how can I do this w/o creating a query that does > the > > > > >following considering that user could have 10 other entires. > > > > > > > > mysql_query("insert into ..."); > > > > $id = mysql_insert_id(); > > > > > > > > > > > > >// Request info > > > > >$result = mysql_query( > > > > >"SELECT * FROM supportsys WHERE email = $email"); > > > > >if (!$result) { > > > > >echo("<P>Error performing query: " . > > > > >mysql_error() . "</P>"); > > > > >exit(); > > > > >} > > > > > > > > > > > > > > >I basicly need to get the id$ of the record just entered > > > > >-- > > > > >Cross Walk Central > > > > >www.crosswalkcentral.net > > > > >Support Center > > > > >Your Web Hosting Community! > > > > > > > > > > > > > > > > > > > > > > > > >-- > > > > >PHP Database Mailing List (http://www.php.net/) > > > > >To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > > > >For additional commands, e-mail: php-db-help@lists.php.net > > > > >To contact the list administrators, e-mail: > > php-list-admin@lists.php.net > > > > ------end of quote------ > > > > > > > > > > > > cynic@mail.cz > > > > ------------- > > > > And the eyes of them both were opened and they saw that their files > > > > were world readable and writable, so they chmoded 600 their files. > > > > - Book of Installation chapt 3 sec 7 > > > > > > > > > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > If you have received this e-mail in error or wish to read our e-mail > disclaimer statement and monitoring policy, please refer to > http://www.drkw.com/disc/email/ or contact the sender. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > IMPORTANT NOTICE The information in this e-mail is confidential and > should > only be read by those persons to whom it is addressed and is not intended > to be relied upon by any person without subsequent written confirmation of > its contents. Furthermore, the content of this e-mail is the personal > view > of the sender and does not represent the advice, views or opinion of our > company. Accordingly, our company disclaim all responsibility and accept > no liability (including in negligence) for the consequences of any person > acting, or refraining from acting, on such information prior to the > receipt > by those persons of subsequent written confirmation. In particular (but > not by way of limitation) our company disclaims all responsibility and > accepts no liability for any e-mails which are defamatory, offensive, > racist or in any other way are in breach of any third party's rights, > including breach of confidence, privacy or other rights. If you have > received this e-mail message in error, please notify me immediately by > telephone. Please also destroy and delete the message from your computer. > Any form of reproduction, dissemination, copying, disclosure, > modification, > distribution and/or publication of this e-mail message is strictly > prohibited. Trinity Mirror plc is the holding company for the Trinity > Mirror group of companies and is registered in England No. 82548, with its > address at Kingsfield Court, Chester Business Park, Chester CH4 9RE. If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender.

« previous php.db (#11541) next »