Solved

uploading text file in to db?

Posted on 2002-04-16
5
233 Views
Last Modified: 2008-03-06
hi all,

while uploading in to text file, I try to display it on the browser.
my text file looks like
"WB00202105286","110","DBB110A.JED","Pass","MSWBT1","2/27/02","8:33:19"
I do like this.
$fcontents = file("/home/ftp/".$category."/".$filename);
for ($i = 0; $i < count($fcontents); $i++){
$p = explode(",",$fcontents[$i]);
     //where $fcontents is a file
by doing this way I can get rid of ,(comma's) but how t oget rid of "(double quotes).

this d.quotes I still get it when I try to display it.
can anyone help me out to solve the problem.
0
Comment
Question by:baska
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 4

Expert Comment

by:lokeshv
ID: 6944321
use str_replace..


Hope this helps

Lk
0
 
LVL 5

Expert Comment

by:andriv
ID: 6944964
You can use stripslashes function:

echo stripslashes($p);
0
 
LVL 5

Expert Comment

by:andriv
ID: 6944965
I'm wrong, I'm thinking of slashes for quotes.
0
 
LVL 8

Accepted Solution

by:
us111 earned 30 total points
ID: 6947242
$a='"WB00202105286","110","DBB110A.JED","Pass","MSWBT1","2/27/02","8:33:19"';
$a = split("[\",]", $a);
for ($i=1;$i<count($a);$i=$i+3)
  print " $a[$i]";
0
 

Author Comment

by:baska
ID: 6959398
Thanks us111,

it works exactly as I want it.

bye
baska




0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question