RE: Remove End of Line Characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



she resolved issue yesterday by changing line:
str_replace($carriage, "", $lines4[$i]);

to 

$lines4[$i] = str_replace($carriage, "", $lines4[$i]);



-----Original Message-----
From: M. Sokolewicz [mailto:tularis@xxxxxxx] 
Sent: Tuesday, July 01, 2008 5:10 AM
To: Wei, Alice J.
Cc: Zephaniah ha Levi; php-windows@xxxxxxxxxxxxx
Subject: Re:  Remove End of Line Characters

Wei, Alice J. wrote:
> Hi,
> 
> for ($i=1; $i <= 3; $i++) {
> 
> echo $i . ": " . $lines4[$i] . "\n";
> list($words, $file) = explode(" ", $lines4[$i]);
> $carriage= array("\r\n", "\r", "\n");
> str_replace($carriage, "", $lines4[$i]);
> echo "File: $file has $words words\n\n";
> $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");
> 
> }
> 
> Is this the change  you told me to change? Or, am I having some other
issues here in this revised code?
> I have just checked my database, and it is still giving me the same
square. Could there be something else that I have missed?
> 
> Thanks for your help.
> 
> Alice

You do realise that you're not assigning the result of the str_replace 
to anything, right? Thus, the entire statement is basically... useless 
(you're replacing all \r, \n, \r\n (this last one will never exist since 
all \r and \n, including \r\n have already been replaced) in a copy of 
$lines4[$i], and then never using that).

Please, post a couple of lines from the files and what you want them to 
become (exactly). I'm a bit confused with just 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" without being able to see what you're talking 
about in the first place.

- Tul


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux