Re: MySQL <-> Oracle8
| From: | Ryan Adams | Date: | Mon, 05 Jun 2000 18:18:09 +0000 |
| Subject: | Re: MySQL <-> Oracle8 | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1074@lists.php.net to get a copy of this message | ||
On Mon, Jun 05, 2000 at 08:03:29PM +0200, Dieter Kneffel wrote:
> Looks like a good idea, basically. But what happens, if there is high
> load on the server and a new entry is inserted into the table between
> my previous insert and this query?
>
Hmm. I would guess that this is an issue with mysql_insert_id() as well.
It might work to lock the tables to prevent this from happening.
i.e.
mysql_query ("lock tables write mytable");
mysql_query ("insert into mytable (fields) values (values)");
$r_id = mysql_query ("select max(my_auto_increment_field) as insert_id from mytable");
mysql_query ("unlock tables mytable");
...
> Thanks,
>
> Dieter
>
> Ryan Adams schrieb:
>
> > you've probably already thought of this but what about
> >
> > "select max(my_auto_increment_field) from mytable"?
> >
> > On Mon, Jun 05, 2000 at 02:39:00AM +0200, Dieter Kneffel wrote:
> > > I need to get the ID generated from a previous INSERT operation.
> > >
> > > Is there an equivalent PHP/Oracle8 function for 'mysql_insert_id()'
> > > using MySQL?
> > > If not, how can I make a simple workaround?
> > >
> > >
> > > Tnx,
> > >
> > > Dieter
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
---end quoted text---