Re: Amount of characters a variable is able to contain

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

 



I'm not sure where you are heading with this, but here goes, if you want to keep lots of data in mysql (PHP should not truncate your data) just use a LONG TEXT or TEXT...

If im not mistaken, TEXT take 2^16 characters, so approximately 4 million characters while LONG TEXTS can take several gigabytes. Don't take this for granted, it depends on your database server version and i also may be wrong at the base...

About your code... why not just do: $message = file_get_contents($file);

Put all the file content in $message, further more, this method doesn't strip your \n\r, the method you had stripped your line feeds.

?? :P

Ron Piggott wrote:
This is a sample of code which takes the $web_page and puts it into
$message

The problem I have is that I have lines in my $web_page files which are
longer (have more characters) than $message is able to handle and chunks
of web page text are simply truncated after the character limit has been
reached.  Is there a way to deal with this and allow $message (for
example) to hold 500 or 1,000 characters --- twice of whatever the
default setting is?

Ron


$lineArray = file($web_page);

// make an empty variable first
$message =  "";

// concat all array element
foreach($lineArray as $eachLine) {
$message .= $eachLine;
}

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux