473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

How to export the data from php to CSV

190 100+
Hi,

i have no problem in export the data from php to csv. But i have struggled to put the <br> in of csv coloumn. Here the details
Expand|Select|Wrap|Line Numbers
  1. PostId    PostTitle   Reply                  Ip
  2.  
  3. 1         test        reply 1               127.0.0.1
  4.                       reply 2
  5.                       reply 3
  6.  
  7.  
  8. 2         test2       response 1            127.0.0.1
  9.                       response 2 
  10.  
In the above example i have export the all the data's into csv. But in "Reply" column i can not give the <br> between the reply/response. How i can separate each reply's?
Oct 28 '10 #1
3 1724
code green
1,726 Expert 1GB
Use strip_tags()
Oct 28 '10 #2
Markus
6,050 Expert 4TB
As far as I know, that isn't how CSV works. You have a row with columns and each field (column) or that row can have one entry, not multiple entries as you appear to desire; you'll have to make a new entry for each reply.
Oct 28 '10 #3
maheswaran
190 100+
strip_tags is not working for me. Here the my code

Expand|Select|Wrap|Line Numbers
  1.  
  2. while ($rowr = mysql_fetch_row($values)) {
  3.  
  4.   for ($j=0;$j<$i;$j++) {
  5.     $csv_output .= "\"".$rowr[$j]."\","; //Here i have generate PostId,PostTitle
  6.  
  7.   }
  8.         //echo $rowr[0]."<bR>";
  9.         $sql1='SELECT response 
  10.         FROM  ost_ticket,ost_ticket_response
  11.         WHERE ost_ticket.ticketID ="'.$rowr[0].'" AND ost_ticket.ticket_id=ost_ticket_response.ticket_id';
  12.  
  13.         $values1=mysql_query($sql1);
  14.  
  15.  
  16.         while (list($response) = mysql_fetch_row($values1)) {
  17.             //$response=strip_tags($response,"<div>");
  18.              $csv_output1 .= "\"".$response."\"";    / Here i have created multiple response for a single post for a single column Reply- Reply should place next line or break in the same reply column                 
  19.         }
  20.  
  21.  
  22.  
  23.  
  24.     $csv_output .= "\"".$rowr3[$j]."\",";
  25.  
  26.      $csv_output .= "\n";
  27.  
  28.   }
  29.  
  30.  
  31.  
  32.  
  33.  
Oct 28 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: ls | last post by:
Hi All, I looking for help with ZODB data export to text file. I have file Data.fs (file becomes from Plone CMS) and I have to display content structure, data like intro, body of article, etc...
4
by: Paolo | last post by:
Hello, I am trying to create a procedure to export my Access data to a word template. I would like to export data from two tables to a word file at the same time. My two tables are named CASES...
6
by: Elena | last post by:
I'm trying to export data to an Excel worksheet. I can export the data in the cell values perfectly. I need the code to change a header and footer for the worksheet, not for the columns. Is...
0
by: d_mike_2004 | last post by:
Hi, I have a web form, which display data from a Database. I'd like to find out how to export data from webform (eg. DataSet) to an RTF file. Would it possible to create tables in RTF as in...
7
by: Vanessa | last post by:
hi Everyone, I have two questions on exporting data to Excel using ASP (w/o converting formatted excel file into web page and then plug in the dynamic data): 1. Can we export data into...
1
by: forumaic | last post by:
Hello, I am trying to export data to excel from datagrid, and I am getting an error: "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." ...
4
by: Max2006 | last post by:
Hi, We are developing a SQL server based asp.net application. As part of requirement we should allow users import/export some relational data through web user interface. We are investigation...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this...
2
by: kashif73 | last post by:
Hi, I want to export data from 4 Access tables to Excel using VBA. The user selects 2 different DATES from the form & based on DATEs criteria all record from 4 tables should be extracted to...
0
by: Manesh Pawar | last post by:
Hello, I want to Export data from ms-Access to Excel. I know the way, How to export data in tabular form. But i need to export data to the random cell of sheet,and print it. I got...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.