Jump to content

[SOLVED] Returning multiple variables from a function


NoUser2U

Recommended Posts

array_fill is NOT the correct function. Incrementally assigning values to an array is actually quite easy. A statement like this automatically adds a value to the next available index:$arr[] = $val;Put that in a loop and $arr will fill up will the changing values of $val. Do you want to return the whole row or just the value of $row['fieldname'] ? Either way, the plan is the same:

while($row = mysql_fetch_assoc($result))	{		$arr[] = $row['fieldname'];	}return($arr);// ORwhile($row = mysql_fetch_assoc($result))	{		$arr[] = $row;	}return($arr);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...