Re: creating an array from a mysql result

From: Date: Mon, 30 Oct 2000 05:59:52 +0000
Subject: Re: creating an array from a mysql result
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22611@lists.php.net to get a copy of this message
On Mon, 30 Oct 2000, joeb wrote: > I was wondering on how to do the following: > > while ( $row = mysql_fetch_row($details) ) { > $field0=$row[0]; > $field1=$row[1]; > $field2[]=$row[2]; To me that looks like it should work. Are all the other rows working? If so, then try: $field2[] .= $row[2]; That always seems to work for me - but I think $field2[] = $row[2] should actually work, so if it's not, perhaps $row[2] has no value..? Or perhaps the query is returning no rows, and therefore the code's not getting executed at all? > $field3=$row[3]; > $field4=$row[4]; > $field5=$row[5]; > $filed6=$row[6]; > } > > *Note I am trying to put field2 into an array > > if ( in_array ($value, $field2) ) { > Do something > } -- Michael

« previous php.general (#22611) next »