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 10:58PM

It seems as though the problem is not with the amount of data, as I have tested the code using only one item from one mysql table as so and it still makes a time out error:

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

$q =
"SELECT customer.Orderid";


$query = "mysql_query($q)";
$cols = "mysql_num_fields($query)";
while ($row = "mysql_fetch_array($query)") {
$nextline = "";
for($i = 0; $i < $cols; $i++) {
// Use .= tather than += so PHP doesn't try to add numerics
$nextline .= $row[ $i ] . ($i < $cols ? ", " : "");
}
fwrite($fp,$nextline);
}
fclose($fp);

So, I'm thinking its a problem with the code. The JOIN part of the code is correct I think, but I am just having problems writing the columns specified in the JOIN onto the csv file. All the code below the SELECT query needs to be checked because I think its causing the time out error.



Edited 2 time(s). Last edit at 03/14/2006 11:02PM by Dane Iracleous.

Options: ReplyQuote


Subject
Written By
Posted
Re: How do I make all columns line up in the same row?
March 14, 2006 10:58PM


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.