Solved

uploading text file in to db?

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to send multiple emails at the same time in PHP 12 57
Check for a change in value in a database row on jquery button click 6 32
PHP AJAX Wordpress 9 19
send post values 7 26
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

776 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