You are here: Re: php/mysql puzzler « PHP Programming Language « IT news, forums, messages
Re: php/mysql puzzler

Posted by Tom on 11/29/06 19:45

Aha! In the course of writing out my problem here (below), I noted the
different versions of PHP my server and my host's server were using.
This was the first time I had taken note of it myself.

Right after this, I changed my code so that it called the adodb_lite
class by reference ( =& ). That solved it. This note on the PHP site
confirms it:

http://us3.php.net/manual/en/language.oop.php#57666

Anyway, if nothing else, this speaks to the power of articulating your
problem when nothing else seems to be working.



On Nov 29, 11:34 am, "Tom" <klenw...@gmail.com> wrote:
> I use the adodb_lite class and I'm getting curious results with a
> wrapper function I've written to insert an array in a table. The
> function has an optional parameter to verify columns (the array keys)
> before executing the statement. It runs this statement:
>
> "SHOW COLUMNS FROM `$table`"
>
> (I've added a larger code snippet below.)
>
> What is weird is that if I call the function more than once, this part
> of it will fail after the first call.
>
> What is weirder is that it works fine on my local server -- I only get
> the problem on my host's server.
>
> Anyone encounter a problem like this? One solution would be just to
> skip the column verification. But I suspect its symptomatic of some
> php or mysql setting that may have unintended consequence elsewhere.
>
> I should note that adodb_lite is called using a singleton pattern, so
> that the same object should be used each time this function is called.
> Could that have something to do with it? Also my host is PHP 4 and my
> local server PHP 5 (and may be using different versions of MySQL as
> well.)
>
> Any help will be appreciated. If you think this is a question better
> aimed at the mysql discussion group, let me know and I'll try there.
>
> Thanks,
> Tom
>
> Code Snippet:
>
> // Get DB Object
> $_ADOcx = amvc_ado_cx($db_name);
>
> // Set Fetch Mode
> $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
>
> // Check Table Columns
> if ( $_FLAG['check_cols'] )
> {
> // SQL Query
> $_SQL['check_cols'] = "SHOW COLUMNS FROM `$table`";
>
> // Run Query
> if ( !$_ADO_r = $_ADOcx->Execute($_SQL['check_cols']) )
> {
> trigger_error("unable to check columns for table [$table]:
> {$_SQL['check_cols']}", E_USER_WARNING);
> return 0;
> }
>
> // Sanity Check
> if ( !$_ADO_r->RecordCount() )
> {
> trigger_error("No record count for table [$table]",
> E_USER_WARNING);
> return 0;
> }
>
> It fails right here, on the RecordCount (but only after first call.)

 

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

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