Perhaps you could elaborate on the exact motive
Say, why would you be checking against the 4th element of an array.
I could understand why you would want to check every element of an array
against a particular value, but why just the 4th element, just for interest.
In response to your question,
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 php-db@lists.php.net
Subject: [PHP-DB] Direct Access to an Array Item?
Date: Tue, 8 Aug 2006 22:34:55 -0400 (EDT)
I want to
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
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] ==
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