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' 
<[EMAIL PROTECTED]>, [EMAIL PROTECTED]      
                    <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:[EMAIL PROTECTED]]
> Sent:   Monday, August 20, 2001 12:20
> To:     [EMAIL PROTECTED]
> 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 <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > 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" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > 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: [EMAIL PROTECTED]
> > > >For additional commands, e-mail: [EMAIL PROTECTED]
> > > >To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> > > ------end of quote------
> > >
> > >
> > > [EMAIL PROTECTED]
> > > -------------
> > > 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to