You are here: Re: [PHP] can not re-use a object « PHP « IT news, forums, messages
Re: [PHP] can not re-use a object

Posted by Joe Wollard on 09/19/05 21:11

> I have try to use the same $db and to create a new one...
Are you trying to use the $db object inside of another function later
in the code? If so you'll need to use $GLOBALS['db'] instead.
Sorry, this is the only thing I can think of with your description
Have you tried a simple test program that does nothing more than
execute your example below 2 or more times?

....well, wait, now I did have an issue where the constructor of an
object was not being executed while mmcache was running. Do you run
mmcache or any other code caching mechanism? (phpinfo() would tell
you if you're not sure)

Good luck!


On Sep 19, 2005, at 6:26 AM, pcarrie@genasys.com wrote:

> Hi! Sorry about the bad english :-[
> I try to re-use an object that manage the mysql connections (it is
> code
> from sugarcrm)
> $db = new PearDatabase();
> $var = "'" . $user_id ."'";
> $pregunta = "SELECT user_name FROM users WHERE id = $var";
> $resultado = $db->query($pregunta, true, "Error filling in user
> array: ");
> $row = $db->fetchByAssoc($resultado);
> $user_name= $row['user_name'];
>
> if i try a new query (can be the same one or an other one), i
> become "0"
> as result and no error message
> I have try to use the same $db and to create a new one, i have try to
> close the descriptor
> Thanks for help
> pascal
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

 

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

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