Solved

uploading text file in to db?

Posted on 2002-04-16
5
240 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
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…

687 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