Re: Amount of characters a variable is able to contain
| From: | Mathieu Dumoulin | Date: | Wed, 01 Feb 2006 15:55:04 +0000 |
| Subject: | Re: Amount of characters a variable is able to contain | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41162@lists.php.net to get a copy of this message | ||
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; }