RE: [PHP-DB] Direct Access to an Array Item?

2006-09-03 Thread Naintara
789"; "123" == current(explode('#', $str)) The result will be true. Not sure if this helps you, but worth a shot. -Original Message- From: J R [mailto:[EMAIL PROTECTED] Sent: 10 August 2006 4:54 AM To: php-db@lists.php.net Subject: [PHP-DB] Direct Access to an Array Item

Re: [PHP-DB] Direct Access to an Array Item?

2006-08-09 Thread Bastien Koert
Closest you might get is if ( mysql_result($result,0,3 ) == 'foo') { $user = $mysql_fetch_row($result); } bastien From: Stut <[EMAIL PROTECTED]> To: Peter Beckman <[EMAIL PROTECTED]> CC: PHP-DB Mailing List Subject: Re: [PHP-DB] Direct Access to an Array Item?

[PHP-DB] Direct Access to an Array Item?

2006-08-09 Thread J R
On 8/9/06, Peter Beckman <[EMAIL PROTECTED]> wrote: I want to access a variable within a function-returned array without setting the array to a variable first. Example -- test for equal to string 'foo' on the 4th element of a returned fetch row: if (($row = mysql_fetch_row($result))[3] ==

Re: [PHP-DB] Direct Access to an Array Item?

2006-08-09 Thread Stut
Peter Beckman wrote: > if (($row = mysql_fetch_row($result))[3] == 'foo') { > $user = $row; > } > > or > > $bar = explode('#', $str)[2]; PHP does not currently support this type of syntax in any form. You must assign the return value of a function to a variable if you want to

Re: [PHP-DB] Direct Access to an Array Item?

2006-08-09 Thread J R
On 8/9/06, Peter Beckman <[EMAIL PROTECTED]> wrote: I want to access a variable within a function-returned array without setting the array to a variable first. Example -- test for equal to string 'foo' on the 4th element of a returned fetch row: if (($row = mysql_fetch_row($result))[3] ==

RE: [PHP-DB] Direct Access to an Array Item?

2006-08-09 Thread Peter Beckman
On Wed, 9 Aug 2006, Bastien Koert wrote: use mysql_result mysql_result ( $result, 0, 2 ) where 2 is the offset of the fields in the row In one line of code, I want to fetch the row into a variable, and test a variable within that row. I want to know how to do this both within a DB query

RE: [PHP-DB] Direct Access to an Array Item?

2006-08-09 Thread Bastien Koert
use mysql_result mysql_result ( $result, 0, 2 ) where 2 is the offset of the fields in the row Bastien From: Peter Beckman <[EMAIL PROTECTED]> To: PHP-DB Mailing List Subject: [PHP-DB] Direct Access to an Array Item? Date: Tue, 8 Aug 2006 22:34:55 -0400 (EDT) I want to access a va

[PHP-DB] Direct Access to an Array Item?

2006-08-08 Thread Peter Beckman
I want to access a variable within a function-returned array without setting the array to a variable first. Example -- test for equal to string 'foo' on the 4th element of a returned fetch row: if (($row = mysql_fetch_row($result))[3] == 'foo') { $user = $row; } or $bar = e