MySQL Forums
Forum List  »  PHP

Re: How do I make all columns line up in the same row?
Posted by: Dane Iracleous
Date: March 14, 2006 09:42AM

So the final code would look like this?

$fp = fopen('csvdir/formdata.csv','w');

$q =
"SELECT c.Orderid, c.shipfname, c.shiplname, c.shipcompany, c.shipaddress*. o.Orderid, o.orderdate, o.ordertime, o.ShipType, o.ShipService, o.ShipCost*, i.OrderidA, i.Item, i.Description*
FROM customer c
INNER JOIN orders o USING (Orderid)
INNER JOIN item i USING (OrderidA)";

$query = "mysql_query($q)";
$cols = "mysql_num_fields($query)";
while ($row = "mysql_fetch_array($query)") {
$nextline = "";
for($i = 0; $i < $cols; $i++) {
$nextline += $row[ $i ] . ($i < $cols ? ", " : "");
}
fwrite($fp,$nextline);
}

Options: ReplyQuote


Subject
Written By
Posted
Re: How do I make all columns line up in the same row?
March 14, 2006 09:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.