You are here: Re: Multiple Statements in a query « PHP Programming Language « IT news, forums, messages
Re: Multiple Statements in a query

Posted by paladin.rithe@gmail.com on 03/04/07 14:02

On Mar 3, 1:07 pm, Dikkie Dik <nos...@nospam.org> wrote:
> > I have 2 statements that I'd like to string together in a query, but
> > according to everything I'm seeing, it's not possible.
> > What I'm doing is an insert of a row, where the primary key is an auto
> > increment. I want to retrieve that by using LAST_INSERT_ID(). I
> > tried sending another query after the first (once I knew that it the
> > data was what I need) but it didn't return anything. It seems that
> > that function can't be used in separate calls or something. Either
> > that or there's a setting that I need to check. Any ideas?
>
> It is already suggested that you post the queries themselves. But it
> could be something else: If you issue the queries in separate
> connections, they will not work together. A connection in MySQL (I
> assume you are using MySQL) is like a session: variables only exist
> within that session and the result of LAST_INSERT_ID is also not visible
> to other connections.
>
> So you do issue the queries in one connection, I hope?
>
> Best regards

I actually solved it a different way. I was using a unique value to
create the table as it was, so I just used that instead.

I was using "SELECT LAST_INSERT_ID();" as my second query. The first
just being a general insert. I'm positive there was nothing wrong
with my queries because I put them in the console, and it worked
fine. I think there might be some issues with my db wrapper, but
that's a separate issue I think.

 

Navigation:

[Reply to this 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

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