Transpose table to column
-
$SQL = "SELECT LastName, FirstName, HomePhone, CellPhone, Address1, City, State, Zip, Email, ID, College1, College2, College3 FROM AAUW_Members ORDER BY Lastname;
How do I transpose the query results to output the following format to a text file? I can output results to a table, I need a column.
….
Axxx, Gxxx
(H) 845/xxx-7398
(C) 914/xxx-5533
15 Dxxx Run Road
Poughkeepsie, NY 12603
[email protected]
ID: 5xxxx
SUNY New Paltz, BS, MS
……$result = mysqli_query($link, $SQL) ; // Download file header record fwrite($output, array( 'LastName', 'FirstName', 'HomePhone', 'CellPhone', 'Address1', 'City', 'State', 'Zip', 'Email', 'ID', 'College1', 'College2', 'College3', )); while ($row = mysqli_fetch_assoc($result)){ // first output the record for download file... fputcsv($output, array( $row['LastName'], $row['FirstName'], $row['HomePhone'], $row['CellPhone'], $row['Address1'], $row['city'], $row['State'], $row['Zip'], $row['Email'], $row['College1'], $row['College2'], $row['College3'], )); } //end while fetch_assoc fclose($output);
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.