[PHP] Re: odbc_fetch_into ??

2002-07-02 Thread Scott Fletcher

I tried this script and it showed all of the data correctly, so how do I
make the define variable to work correctly?

--clip--
 // 97 columns are used, so I used 98 to stop the loop (this loop is for
testing only)
 for($x=0;$x98;$x++)
 {
echo $user_detail[$x].br;
 }
--clip--
Scott Fletcher [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 odbc_fetch_into didn't give me the result I expect it to.  When returning
 the data, It skipped some columns.  With the register_global turned off.
 How do I transform the defined data into an array to be use for
 odbc_fetch_into?  I never got it to work right.  I will appreciate any of
 the help here.  Never had that problem with global_register turned on.

 --clip--
 define(CUSTOMER_ID,0);
 define(CUSTOMER_NAME,1);
 define(STATE,6);

 // blah blah blah

   if (odbc_fetch_row($result))
   {
 odbc_fetch_into($result,$user_detail,1);
 {
echo $user_detail[STATE];
 }
   }
 --clip--

 I expect the result to give me the state name, not zip code or address
 number, etc.

 Thanks,
  Scott





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: odbc_fetch_into ??

2002-07-02 Thread Analysis Solutions

Scott:

On Tue, Jul 02, 2002 at 10:05:31AM -0400, Scott Fletcher wrote:
 I tried this script and it showed all of the data correctly, so how do I
 make the define variable to work correctly?
 
  define(CUSTOMER_ID,0);
  define(CUSTOMER_NAME,1);
  define(STATE,6);
 
  // blah blah blah
 
if (odbc_fetch_row($result))
{
  odbc_fetch_into($result,$user_detail,1);
  {
 echo $user_detail[STATE];
  }
}

Why not make life simpler via odbc_fetch_array()?  The names of the fields
become the names of the array's keys.  Drop the defines() and 
odbc_fetch_row() and just do this:

  while ( $user_detail = odbc_fetch_array($result) ) {
 echo $user_detail['State'];
  }

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: odbc_fetch_into ??

2002-07-02 Thread Scott Fletcher

That's a great idea!  Less hassle to deal with updating the defines() over
the time.  I have one little problem.  If I do the odbc_fetch_array then I
can't include two tables because of the two of the same column name.  Look
like I'll have to use one array for one table and one other array for one
other table.  Sigh!  I'm not looking forward to it because I had to update
the website to deal without the register_global and now this.  In the long
run, it will be worth it.  My boss is going to be after my hide for the time
it take to upgrade the website to work with the newer version of PHP.  Heh,
heh.  I'm going to have to change the job soon because of the poor work
policy and lousy salary.  Well, wish I can leave now but I'm not ready for
that yet.

Thanks!
 Scott F.

Analysis  Solutions [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Scott:

 On Tue, Jul 02, 2002 at 10:05:31AM -0400, Scott Fletcher wrote:
  I tried this script and it showed all of the data correctly, so how do I
  make the define variable to work correctly?
 
   define(CUSTOMER_ID,0);
   define(CUSTOMER_NAME,1);
   define(STATE,6);
  
   // blah blah blah
  
 if (odbc_fetch_row($result))
 {
   odbc_fetch_into($result,$user_detail,1);
   {
  echo $user_detail[STATE];
   }
 }

 Why not make life simpler via odbc_fetch_array()?  The names of the fields
 become the names of the array's keys.  Drop the defines() and
 odbc_fetch_row() and just do this:

   while ( $user_detail = odbc_fetch_array($result) ) {
  echo $user_detail['State'];
   }

 --Dan

 --
PHP classes that make web design easier
 SQL Solution  |   Layout Solution   |  Form Solution
 sqlsolution.info  | layoutsolution.info |  formsolution.info
  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: odbc_fetch_into ??

2002-07-02 Thread Analysis Solutions

Hi Scott:

On Tue, Jul 02, 2002 at 11:08:30AM -0400, Scott Fletcher wrote:
 That's a great idea!

Good.

 I have one little problem.  If I do the odbc_fetch_array then I
 can't include two tables because of the two of the same column name.

In your query, rename the fields using an AS statement.

SELECT Tbl1.ID AS ID1, Tbl2.ID AS ID2 FROM...

Then, in your data array, refer to them as 'ID1' and 'ID2.'  You can name 
the fields nearly anything you want (as long as you're not using a 
reserved word the database needs for internal use).

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: odbc_fetch_into ??

2002-07-02 Thread Scott Fletcher

That function, odbc_fetch_array() does not work.  PHP spit out the error,
undefined function.

Analysis  Solutions [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Scott:

 On Tue, Jul 02, 2002 at 10:05:31AM -0400, Scott Fletcher wrote:
  I tried this script and it showed all of the data correctly, so how do I
  make the define variable to work correctly?
 
   define(CUSTOMER_ID,0);
   define(CUSTOMER_NAME,1);
   define(STATE,6);
  
   // blah blah blah
  
 if (odbc_fetch_row($result))
 {
   odbc_fetch_into($result,$user_detail,1);
   {
  echo $user_detail[STATE];
   }
 }

 Why not make life simpler via odbc_fetch_array()?  The names of the fields
 become the names of the array's keys.  Drop the defines() and
 odbc_fetch_row() and just do this:

   while ( $user_detail = odbc_fetch_array($result) ) {
  echo $user_detail['State'];
   }

 --Dan

 --
PHP classes that make web design easier
 SQL Solution  |   Layout Solution   |  Form Solution
 sqlsolution.info  | layoutsolution.info |  formsolution.info
  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: odbc_fetch_into ??

2002-07-02 Thread Analysis Solutions

On Tue, Jul 02, 2002 at 11:59:59AM -0400, Scott Fletcher wrote:
 That function, odbc_fetch_array() does not work.  PHP spit out the error,
 undefined function.

Huh?  Which version of PHP are you using?  It's available in 4.0.2 or 
greater.  Did you misspell the function name?

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: odbc_fetch_into ??

2002-07-02 Thread Dan Vande More

Did you remember to compile ODBC into PHP?

./configure --help shows these odbc options:

  --with-iodbc[=DIR]  Include iODBC support.  DIR is the iODBC base
  install directory, defaults to /usr/local.
  --with-unixODBC[=DIR]   Include unixODBC support.  DIR is the unixODBC base
  install directory, defaults to /usr/local.

Dan

-Original Message-
From: Analysis  Solutions [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 10:50 AM
To: PHP List
Subject: Re: [PHP] Re: odbc_fetch_into ??


On Tue, Jul 02, 2002 at 11:59:59AM -0400, Scott Fletcher wrote:
 That function, odbc_fetch_array() does not work.  PHP spit out the error,
 undefined function.

Huh?  Which version of PHP are you using?  It's available in 4.0.2 or 
greater.  Did you misspell the function name?

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: odbc_fetch_into ??

2002-07-02 Thread Scott Fletcher

php 4.2.1.  On the php.net website, the odbc_fetch_array webpage, it stated
that it become unavailable with around php 4.1.1.  Some of the other odbc
functions became unavailable also.

Analysis  Solutions [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Tue, Jul 02, 2002 at 11:59:59AM -0400, Scott Fletcher wrote:
  That function, odbc_fetch_array() does not work.  PHP spit out the
error,
  undefined function.

 Huh?  Which version of PHP are you using?  It's available in 4.0.2 or
 greater.  Did you misspell the function name?

 --Dan

 --
PHP classes that make web design easier
 SQL Solution  |   Layout Solution   |  Form Solution
 sqlsolution.info  | layoutsolution.info |  formsolution.info
  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php