php-windows Digest 30 Jun 2008 17:24:39 -0000 Issue 3498
Topics (messages 28983 through 28983):
Remove End of Line Characters
28983 by: Wei, Alice J.
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi,
I have a simple file as follows:
There are in the total of 513 words in sinus.txt, lung.txt and stomach.txt.
151 sinus.txt
105 lung.txt
257 stomach.txt
What I want to do is to print the first line in the Description column, and
have each of the following lines be entered into the database by assigning the
number as $words, and the filename into the Filename column.
The script in the following performs exactly the way I wanted, except for the
fact that in my database, each of the entries looks something like this:
sinus.txt followed by a square for each of the variables that contains text. I
don't have this problem for my numbers at all.
for ($i=1; $i <= 3; $i++) {
echo $i . ": " . $lines4[$i] . "\n";
list($words, $file) = explode(" ", $lines4[$i]);
echo "File: $file has $words words\n\n";
substr($file, 0, -3);
//substr($lines4['0'],0,-1);
$query3="INSERT INTO youtoo(Description,Filename,Words) VALUES
('$lines4[0]','$file', '$words')";
$result1= mssql_query($query3) or die ("Couldn't Create New Entry into Database
$myDB");
}
I tried using rtrim(), chop() using the $line4 as I have declared and there is
no use. Finally, I used substr(), but this does not seem to get what I wanted
either, and the square is still in the way. I checked my text file in the text
editor, and I see nothing that could have produced the square during the
database entering process.
Does anyone know what I have done wrong here? Anything is appreciated.
Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]
--- End Message ---