Re: How do I dump a blob or text into a mySQL Database?
| From: | David Nicholson | Date: | Mon, 14 Jul 2003 18:42:32 +0000 |
| Subject: | Re: How do I dump a blob or text into a mySQL Database? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155138@lists.php.net to get a copy of this message | ||
Hello,
This is a reply to an e-mail that you wrote on Mon, 14 Jul 2003 at 18:48,
lines prefixed by '>' were originally written by you.
> I'm trying to split up a file and dump it into a mySQL database BLOB.
> Wherever I run the query:
> mysql_query("INSERT INTO table (field) VALUES ('{$buffer}')");
> Nothing ever shows up in the table whethere field is a text or a
> blob
> and whether I dump in text or binary. Oddly enough when I run the
> query
> I get no error, and can print it and run it through a mySQL terminal,
> and it works.
Change your line of code to something like this:
mysql_query("INSERT INTO table (field) VALUES ('{$buffer}')") or
die(mysql_error());
to find out what is going wrong.
Has the data in $buffer been escaped, reay to go straight into the
query? if not add the line:
$buffer = mysql_escape_string($buffer);
beofre the one that you mentioned above.
HTH
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)