You are here: Re: PHP 5 and PDO « PHP Programming Language « IT news, forums, messages
Re: PHP 5 and PDO

Posted by mpar612 on 04/29/07 21:36

On Apr 29, 4:12 pm, "amygdala" <nore...@noreply.com> wrote:
> "mpar612" <mpar...@gmail.com> schreef in berichtnews:1177877211.921774.82090@h2g2000hsg.googlegroups.com...
>
>
>
> >> (assuming you posted all relevant code)
>
> >> You create a PDO instance $dbh, use it, and then you destroy the object:
> >> the next query can never be executed. Why the $dbh=null; ?
> >> Either strip those out of your code, or re-instantiate a PDO object
> >> before
> >> using it again.
>
> >> The object will automatically be destroyed by PHP when the script ends.
>
> >> HTH
>
> >> Sh
>
> > Thanks! I removed those $dbh=null; and still no luck. I know the SQL
> > statements are correct. They work perfectly in the code that I wrote
> > the code that uses the PEAR DB module. I have posted every bit of PHP
> > code that is on the page. All of the rest is just static HTML. Any
> > other thoughts? Thanks!
>
> What happens if you do a...
>
> try
> {
> $dbh->query('my query');}
>
> catch ( PDOException $e )
> {
> die( $e->getMessage() . ' on line: ' . __LINE__ );
>
> }
>
> ...for both queries?
>
> I suspect it could have something to do with buffered queries. I've had some
> occasions where I got error messages stating that I should use:
>
> $dbh->setAttribute( PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, TRUE );
>
> .. because another query is not finished yet, eventhough for instance, only
> one
> row should be returned and I fetched that row already.
> I haven't given it enough attention yet, and just set the attribute to true,
> but it looks like it could be some bug.
>
> HTH

Thanks for the response! That didn't do anything, but return a blank
screen. I did a little playing around and the first statement works.
If I comment out that query and enter a hard value into the 2nd query,
it works. So, I think I need to figure out how to close the first
query so the 2nd query can execute. Does that make sense? Any
thoughts?

Thanks!

 

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

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