I'm trying to write the results of a mysql_fetch_array db query to a file and am unable to. I'm putting the results into a variable $fileContent and then using fwrite(). I would have liked to do something like: $filecontent = . $result = mysql_query( " SELECT orderedItems.*, items.* FROM orderedItems, items WHERE orderedItems.orderID=$orderID[0] AND orderedItems.itemID=items.itemsID "); while($row = mysql_fetch_array( $result )) { $theItemID=$row["orderedItems.itemID"]; $theItemPrice=$row["itemPrice"]; $theItemQty=$row["itemQty"]; $thisItemID= sprintf("% 6d",$theItemID); $thisItemPrice= sprintf("%7.2f",$theItemPrice); $thisItemQty= sprintf("% 7d",$theItemQty); $thisOrder . $thisItemID . $thisItemPrice . $thisItemQty . } "; // end of $filecontent but that doesn't work. Mayo