From: "Dave G" <[EMAIL PROTECTED]> > PHP Gurus,
If you say so... > I'm trying to put the results of a query into an array. > My code looks like this: > <?php > $query = "SELECT datecolumn FROM table WHERE MONTH(datecolumn) = " . > $currentMonth; > $result = mysql_query($query); > $numRows = mysql_num_rows($result); > for($i = 0; $i<$numRows; $i++) > { > $workshops[$i] = mysql_fetch_row($result); > echo $workshops[$i] . "<br />"; > } > echo "The results of the array are - " . $workshops[0] . " and " . > $workshops[1]; > ?> > When I run this, the output to the screen says: > --- > Array > Array > The results of the array are - Array and Array > --- Exactly what it should be. mysql_fetch_row returns an array, which you're assiging to $workshops[0] and $workshops[1]. Try: echo "The results of the array are - " . $workshops[0][0] . " and " . $workshops[1][0]; Or, even better... $query = "SELECT datecolumn FROM table WHERE MONTH(datecolumn) = " . $currentMonth; $result = mysql_query($query); while($r = mysql_fetch_row($result)) { $workshop[] = $r[0]; } echo "The results of the array are - " . $workshops[0] . " and " . $workshops[1]; ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php