RE: [PHP-DB] storing bzcompressed data in MySQL
| From: | John W. Holmes | Date: | Sun, 13 Apr 2003 19:22:54 +0000 |
| Subject: | RE: [PHP-DB] storing bzcompressed data in MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27059@lists.php.net to get a copy of this message | ||
> I've got an automated system that will be storing text files of up to
> about 20k. In peak times, I expect to have two to three million of
> these text files "on demand", though in reality they'll be expired
*way*
> more often than they're referenced.
>
> To save space, I'd like to store the text using bzcompress(), but when
I
> use a construct like this:
>
> $q = "INSERT INTO item (bztext) ('" . bzcompress($text,9) . "')";
>
> But running the query gets my mysql_error() results of
> You have an error in your SQL syntax near '$¢icÍeÖ3 ÒmX®""
> EèÓÊÊA*"("M0¤´è,¨
> ÚP#®ïsÂüÞ´+Ò÷jW6%e VdÁ' at line 2
www.php.net/addslashes
$q = "INSERT INTO item (bztext) ('" . addslashes(bzcompress($text,9)) ..
"')";
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/